-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
6 changed files
with
50 additions
and
25 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 |
---|---|---|
|
@@ -48,25 +48,28 @@ def test_clear_matches(client): | |
@patch('tuber.api.uber.requests.post') | ||
def test_staffer_auth(mock_post, client): | ||
"""Make sure the staffer login system is able to authenticate against uber""" | ||
from tuber.database import db | ||
from tuber.models import Event, Badge | ||
event = Event(name="MAGWest 2024", description="West Event", uber_url="https://west2024.test.com", uber_apikey="123456", uber_slug="west2024") | ||
db.add(event) | ||
db.commit() | ||
results = [{"result": []}, {"result": ["234"]},{"result": [{"id": "234", "email": "[email protected]", "assigned_depts_labels": [], "badge_status_label": "", "staffing": True, "badge_num": "", "badge_printed_name": "", "full_name": "", "first_name": "", "last_name": "", "legal_name": "", "ec_name": "", "ec_phone": "", "cellphone": ""}]}] | ||
mock_post.return_value.json = results.pop | ||
rv = client.post('/api/uber_login', json={"token": "234"}) | ||
rv = client.post('/api/uber/west2024/login', json={"token": "234"}) | ||
assert(rv.status_code == 200) | ||
|
||
from tuber.database import db | ||
from tuber.models import Badge | ||
badge = Badge(email="[email protected]", uber_id="123") | ||
db.add(badge) | ||
db.commit() | ||
|
||
results = [{"result": []}, {"result": ["123"]},{"result": [{"id": "123", "email": "[email protected]", "assigned_depts_labels": [], "badge_status_label": "", "staffing": True, "badge_num": "", "badge_printed_name": "", "full_name": "", "first_name": "", "last_name": "", "legal_name": "", "ec_name": "", "ec_phone": "", "cellphone": ""}]}] | ||
mock_post.return_value.json = results.pop | ||
rv = client.post('/api/uber_login', json={"token": "123"}) | ||
rv = client.post('/api/uber/west2024/login', json={"token": "123"}) | ||
assert(rv.status_code == 200) | ||
|
||
results = [{"result": []}, {"result": ["234"]},{"result": [{"id": "456", "email": "[email protected]", "assigned_depts_labels": [], "badge_status_label": "", "staffing": True, "badge_num": "", "badge_printed_name": "", "full_name": "", "first_name": "", "last_name": "", "legal_name": "", "ec_name": "", "ec_phone": "", "cellphone": ""}]}] | ||
mock_post.return_value.json = results.pop | ||
rv = client.post('/api/uber_login', json={"token": "456"}) | ||
rv = client.post('/api/uber/west2024/login', json={"token": "456"}) | ||
assert(rv.status_code != 200) | ||
|
||
def test_requests(client): | ||
|
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