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.
Fix line-endings on test_statement_json.py
- Loading branch information
1 parent
2394b74
commit 1811bfc
Showing
1 changed file
with
43 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
from __future__ import print_function, unicode_literals | ||
|
||
import json | ||
|
||
from gittip.testing import Harness | ||
from gittip.testing.client import TestClient | ||
|
||
|
||
class Tests(Harness): | ||
|
||
def change_statement(self, statement, number='singular', user='alice'): | ||
self.make_participant('alice') | ||
|
||
client = TestClient() | ||
response = client.get('/') | ||
csrf_token = response.request.context['csrf_token'] | ||
|
||
response = client.post( "/alice/statement.json" | ||
, { 'statement': statement | ||
, 'number': number | ||
, 'csrf_token': csrf_token | ||
} | ||
, user=user | ||
) | ||
return response | ||
|
||
def test_participant_can_change_their_statement(self): | ||
response = self.change_statement('being awesome.') | ||
actual = json.loads(response.body)['statement'] | ||
assert actual == 'being awesome.', actual | ||
|
||
def test_participant_can_change_their_number(self): | ||
response = self.change_statement('', 'plural') | ||
actual = json.loads(response.body)['number'] | ||
assert actual == 'plural', actual | ||
|
||
def test_anonymous_gets_404(self): | ||
response = self.change_statement('being awesome.', 'singular', user=None) | ||
assert response.code == 404, response.code | ||
|
||
def test_invalid_is_400(self): | ||
response = self.change_statement('', 'none') | ||
assert response.code == 400, response.code | ||
from __future__ import print_function, unicode_literals | ||
|
||
import json | ||
|
||
from gittip.testing import Harness | ||
from gittip.testing.client import TestClient | ||
|
||
|
||
class Tests(Harness): | ||
|
||
def change_statement(self, statement, number='singular', user='alice'): | ||
self.make_participant('alice') | ||
|
||
client = TestClient() | ||
response = client.get('/') | ||
csrf_token = response.request.context['csrf_token'] | ||
|
||
response = client.post( "/alice/statement.json" | ||
, { 'statement': statement | ||
, 'number': number | ||
, 'csrf_token': csrf_token | ||
} | ||
, user=user | ||
) | ||
return response | ||
|
||
def test_participant_can_change_their_statement(self): | ||
response = self.change_statement('being awesome.') | ||
actual = json.loads(response.body)['statement'] | ||
assert actual == 'being awesome.', actual | ||
|
||
def test_participant_can_change_their_number(self): | ||
response = self.change_statement('', 'plural') | ||
actual = json.loads(response.body)['number'] | ||
assert actual == 'plural', actual | ||
|
||
def test_anonymous_gets_404(self): | ||
response = self.change_statement('being awesome.', 'singular', user=None) | ||
assert response.code == 404, response.code | ||
|
||
def test_invalid_is_400(self): | ||
response = self.change_statement('', 'none') | ||
assert response.code == 400, response.code |