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.
Convert payin_suspended to is_suspicious (#354)
- Loading branch information
1 parent
7f8bff0
commit 4b08a1f
Showing
9 changed files
with
90 additions
and
84 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 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
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,53 @@ | ||
from gittip.testing import load, serve_request | ||
|
||
|
||
def participants(foo_starts_suspicious=None): | ||
participants = ( {"id": "foo"} | ||
, {"id": "bar", "is_admin": True} | ||
) | ||
if foo_starts_suspicious is not None: | ||
participants[0]["is_suspicious"] = foo_starts_suspicious | ||
return load('participants', *participants) | ||
|
||
|
||
def toggle_is_suspicious(): | ||
response = serve_request('/foo/toggle-is-suspicious.json', user='bar') | ||
return response.body | ||
|
||
|
||
def test_participants_start_out_with_is_suspicious_None(): | ||
with participants() as context: | ||
actual = context.dump()['participants']['foo']['is_suspicious'] | ||
assert actual is None, actual | ||
|
||
def test_toggling_NULL_gives_true(): | ||
with participants() as context: | ||
toggle_is_suspicious() | ||
actual = context.diff()['participants']['updates'][0]['is_suspicious'] | ||
assert actual is True, actual | ||
|
||
def test_toggling_changes_two_things(): | ||
with participants() as context: | ||
toggle_is_suspicious() | ||
actual = context.diff(compact=True) | ||
assert actual == {'participants': [0,2,0]}, actual | ||
|
||
def test_but_the_second_thing_is_just_bars_session(): | ||
with participants() as context: | ||
toggle_is_suspicious() | ||
expected = ('bar', ['id', 'session_expires', 'session_token']) | ||
second = context.diff()['participants']['updates'][1] | ||
actual = (second['id'], sorted(second.keys())) | ||
assert actual == expected, actual | ||
|
||
def test_toggling_true_gives_false(): | ||
with participants(True) as context: | ||
toggle_is_suspicious() | ||
actual = context.diff()['participants']['updates'][0]['is_suspicious'] | ||
assert actual is False, actual | ||
|
||
def test_toggling_false_gives_true(): | ||
with participants(False) as context: | ||
toggle_is_suspicious() | ||
actual = context.diff()['participants']['updates'][0]['is_suspicious'] | ||
assert actual is True, actual |
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
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