This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c84d27
commit 585f16e
Showing
15 changed files
with
150 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
{{ _("We have your application!") }} | ||
|
||
[---] text/html | ||
{{ _("Thanks for your project application for {0}! Your public project page is: " | ||
"{1} " | ||
"and your public review ticket is: " | ||
"{2}. " | ||
"You can watch and participate in our review process there. We will send a notification to {3} when we finish our review. " | ||
"Thanks for applying!", | ||
team_name, team_url, review_url, email) }} | ||
{{ _( "Thanks for applying to use Gratipay! The next step is for us to review your application, " | ||
"which happens on {a}this public GitHub issue{_a}. You can watch and participate in our " | ||
"review there, and we will email you again when we finish (usually in about a week). " | ||
"Thanks again!" | ||
, a='<a href="{}">'.format(review_url)|safe | ||
, _a='</a>'|safe | ||
) }} | ||
|
||
[---] text/plain | ||
{{ _("Thanks for your project application for {0}! Your public project page is: " | ||
"{1} " | ||
"and your public review ticket is: " | ||
"{2}. " | ||
"You can watch and participate in our review process there. We will send a notification to {3} when we finish our review. " | ||
"Thanks for applying!", | ||
team_name, team_url, review_url, email) }} | ||
{{ _( "Thanks for applying to use Gratipay! The next step is for us to review your application, " | ||
"which happens on this public GitHub issue:") }} | ||
|
||
{{ review_url }} | ||
|
||
{{ _( "You can watch and participate in our review there, and we will email you again when we " | ||
"finish (usually in about a week). Thanks again!") }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
from cStringIO import StringIO | ||
|
||
import mock | ||
from gratipay.testing import T | ||
from gratipay.testing.email import QueuedEmailHarness | ||
from pytest import raises | ||
|
||
from gratipay.project_review_process import ConsolePoster, ProjectReviewProcess | ||
from gratipay.exceptions import NoTeams | ||
|
||
|
||
class ENV_GH(object): | ||
project_review_repo = 'some/repo' | ||
project_review_username = 'cheeseburger' | ||
project_review_token = 'di3tc0ke' | ||
|
||
|
||
class ENV(object): | ||
project_review_repo = '' | ||
project_review_username = '' | ||
project_review_token = '' | ||
|
||
|
||
class Tests(QueuedEmailHarness): | ||
|
||
def setUp(self): | ||
QueuedEmailHarness.setUp(self) | ||
self.project_review_process = ProjectReviewProcess(ENV, self.db, self.app.email_queue) | ||
|
||
|
||
def test_console_poster_posts_to_fp(self): | ||
fp = StringIO() | ||
poster = ConsolePoster(fp) | ||
poster.post('{"blah": "blah blah"}') | ||
fp.seek(0) | ||
assert fp.read() == '''\ | ||
------------------------------------------------------------------------------ | ||
{u'blah': u'blah blah'} | ||
------------------------------------------------------------------------------ | ||
''' | ||
|
||
|
||
@mock.patch('gratipay.project_review_process.requests.post') | ||
def test_github_poster_attempts_to_post_to_github(self, post): | ||
foo = self.make_team(name='foo') | ||
bar = self.make_team(name='bar') | ||
baz = self.make_team(name='baz') | ||
|
||
post.return_value = '' | ||
|
||
ProjectReviewProcess(ENV_GH, self.db, self.app.email_queue).start(foo, bar, baz) | ||
|
||
assert post.call_count == 1 | ||
args, kwargs = post.mock_calls[0][1:] | ||
assert args[0] == 'https://api.github.com/repos/some/repo/issues' | ||
assert kwargs['data'] == ( | ||
'{"body": "https://gratipay.com/foo/\\nhttps://gratipay.com/bar/\\n' | ||
'https://gratipay.com/baz/\\n\\n(This application will remain open ' | ||
'for at least a week.)", "title": "foo and 2 other projects"}') | ||
assert kwargs['auth'] == ('cheeseburger', 'di3tc0ke') | ||
|
||
|
||
def test_team_objects_get_review_url(self): | ||
foo = self.make_team(name='foo') | ||
assert foo.review_url is None | ||
self.project_review_process.start(foo) | ||
assert foo.review_url == T('foo').review_url == 'some-github-issue' | ||
|
||
|
||
def test_owner_gets_an_email_notification(self): | ||
foo = self.make_team(name='foo') | ||
self.project_review_process.start(foo) | ||
assert self.get_last_email()['subject'] == 'We have your application!' | ||
|
||
|
||
def test_no_teams_raises(self): | ||
raises(NoTeams, self.project_review_process.start) | ||
|
||
|
||
def test_multiple_owners_raises(self): | ||
foo = self.make_team(name='foo') | ||
bar = self.make_team(name='bar', owner='crusher') | ||
raises(AssertionError, self.project_review_process.start, foo, bar) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,7 +245,7 @@ def test_application_email_sent_to_owner(self): | |
last_email = self.get_last_email() | ||
self.app.email_queue.flush() | ||
assert last_email['to'] == 'alice <[email protected]>' | ||
expected = "Thanks for your project application for" | ||
expected = "Thanks for applying to use Gratipay!" | ||
assert expected in last_email['body_text'] | ||
|
||
def test_401_for_anon_creating_new_team(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters