Skip to content

Commit

Permalink
Updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed Oct 16, 2024
1 parent 02622f1 commit 78a8dd2
Showing 1 changed file with 207 additions and 3 deletions.
210 changes: 207 additions & 3 deletions backend/tests/test_hotel.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,75 @@ def test_staffer_auth(mock_post, client):
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": "test1@test.com", "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": ""}]}]
results = [
{
"jsonrpc": "2.0",
"id": None,
"result": {
"unknown_ids": [],
"unknown_emails": [],
"unknown_names": [],
"unknown_names_and_emails": [],
"attendees": [
{
"_model": "Attendee",
"id": "234",
"first_name": "Test",
"last_name": "Johnson",
"legal_name": "",
"birthdate": "1999-09-09",
"email": "test@johnson.com",
"zip_code": "11111",
"address1": "",
"address2": "",
"city": "",
"region": "",
"country": "",
"international": False,
"ec_name": "Rest Johnson",
"ec_phone": "1111111111",
"cellphone": "2222222222",
"badge_printed_name": "Test",
"badge_num": 28,
"found_how": "",
"comments": "",
"admin_notes": "",
"all_years": "",
"badge_status": 215389669,
"badge_status_label": "Complete",
"shirt": 5,
"assigned_depts": {
"165d54e4-f013-4a1c-ba43-04b67842f538": "Staff Suite",
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"78fec181-7e4f-4615-8b67-057718c89af0": "Staff Tea Room",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS",
"23be7a68-5d9e-4d59-80e1-f641a6d0b6d4": "Logistics"
},
"checklist_admin_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"dept_head_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"poc_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"requested_depts": {}
}
]
}
},
{
"jsonrpc": "2.0",
"id": None,
"result": [
"234",
]
}
]
mock_post.return_value.json = results.pop
rv = client.post('/api/uber/west2024/login', json={"token": "234"})
assert(rv.status_code == 200)
Expand All @@ -62,12 +130,148 @@ def test_staffer_auth(mock_post, client):
db.add(badge)
db.commit()

results = [{"result": []}, {"result": ["123"]},{"result": [{"id": "123", "email": "test2@test.com", "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": ""}]}]
results = [
{
"jsonrpc": "2.0",
"id": None,
"result": {
"unknown_ids": [],
"unknown_emails": [],
"unknown_names": [],
"unknown_names_and_emails": [],
"attendees": [
{
"_model": "Attendee",
"id": "123",
"first_name": "Test",
"last_name": "Johnson",
"legal_name": "",
"birthdate": "1999-09-09",
"email": "test@johnson.com",
"zip_code": "11111",
"address1": "",
"address2": "",
"city": "",
"region": "",
"country": "",
"international": False,
"ec_name": "Rest Johnson",
"ec_phone": "1111111111",
"cellphone": "2222222222",
"badge_printed_name": "Test",
"badge_num": 28,
"found_how": "",
"comments": "",
"admin_notes": "",
"all_years": "",
"badge_status": 215389669,
"badge_status_label": "Complete",
"shirt": 5,
"assigned_depts": {
"165d54e4-f013-4a1c-ba43-04b67842f538": "Staff Suite",
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"78fec181-7e4f-4615-8b67-057718c89af0": "Staff Tea Room",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS",
"23be7a68-5d9e-4d59-80e1-f641a6d0b6d4": "Logistics"
},
"checklist_admin_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"dept_head_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"poc_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"requested_depts": {}
}
]
}
},
{
"jsonrpc": "2.0",
"id": None,
"result": [
"123",
]
}
]
mock_post.return_value.json = results.pop
rv = client.post('/api/uber/west2024/login', json={"token": "123"})
assert(rv.status_code == 200)

results = [{"result": []}, {"result": ["234"]},{"result": [{"id": "456", "email": "test3@test.com", "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": ""}]}]
results = [
{
"jsonrpc": "2.0",
"id": None,
"result": {
"unknown_ids": [],
"unknown_emails": [],
"unknown_names": [],
"unknown_names_and_emails": [],
"attendees": [
{
"_model": "Attendee",
"id": "234",
"first_name": "Test",
"last_name": "Johnson",
"legal_name": "",
"birthdate": "1999-09-09",
"email": "test@johnson.com",
"zip_code": "11111",
"address1": "",
"address2": "",
"city": "",
"region": "",
"country": "",
"international": False,
"ec_name": "Rest Johnson",
"ec_phone": "1111111111",
"cellphone": "2222222222",
"badge_printed_name": "Test",
"badge_num": 28,
"found_how": "",
"comments": "",
"admin_notes": "",
"all_years": "",
"badge_status": 215389669,
"badge_status_label": "Complete",
"shirt": 5,
"assigned_depts": {
"165d54e4-f013-4a1c-ba43-04b67842f538": "Staff Suite",
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"78fec181-7e4f-4615-8b67-057718c89af0": "Staff Tea Room",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS",
"23be7a68-5d9e-4d59-80e1-f641a6d0b6d4": "Logistics"
},
"checklist_admin_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"dept_head_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"poc_depts": {
"22df636d-dd03-4b9b-86a8-f2213f116a78": "Reinforcements",
"3324860f-159a-43fb-b2ab-d4eea329a592": "STOPS"
},
"requested_depts": {}
}
]
}
},
{
"jsonrpc": "2.0",
"id": None,
"result": [
"234",
]
}
]
mock_post.return_value.json = results.pop
rv = client.post('/api/uber/west2024/login', json={"token": "456"})
assert(rv.status_code != 200)
Expand Down

0 comments on commit 78a8dd2

Please sign in to comment.