mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Reformatted a handful more tests
Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
@@ -26,10 +26,10 @@ def test_raises_when_overriding_custom_properties():
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"json_response",
|
||||
(
|
||||
[
|
||||
{},
|
||||
{"foo": "bar"}, # Should still raise an exception
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_model_raises_for_unknown_attributes(json_response):
|
||||
class Custom(JSONModel):
|
||||
@@ -56,10 +56,10 @@ def test_model_raises_keyerror_if_item_missing_from_dict():
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"json_response",
|
||||
(
|
||||
[
|
||||
{},
|
||||
{"foo": "bar"}, # Should be ignored
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_model_doesnt_swallow_attribute_errors(json_response):
|
||||
class Custom(JSONModel):
|
||||
|
||||
@@ -5,8 +5,8 @@ from tests.conftest import sample_uuid
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"key, value_from, value_to, expected",
|
||||
(
|
||||
("key", "value_from", "value_to", "expected"),
|
||||
[
|
||||
("restricted", True, False, ("Made this service live")),
|
||||
("restricted", False, True, ("Put this service back into trial mode")),
|
||||
("active", False, True, ("Unsuspended this service")),
|
||||
@@ -70,7 +70,7 @@ from tests.conftest import sample_uuid
|
||||
"bar",
|
||||
("Updated the callback for delivery receipts"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_service_event(
|
||||
key,
|
||||
|
||||
@@ -6,7 +6,7 @@ from tests.conftest import SERVICE_ONE_ID
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"job_status, num_notifications_created, expected_still_processing",
|
||||
("job_status", "num_notifications_created", "expected_still_processing"),
|
||||
[
|
||||
("scheduled", 0, True),
|
||||
("cancelled", 10, True),
|
||||
|
||||
@@ -5,8 +5,8 @@ from tests import organization_json
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"purchase_order_number,expected_result",
|
||||
[[None, None], ["PO1234", [None, None, None, "PO1234"]]],
|
||||
("purchase_order_number", "expected_result"),
|
||||
[(None, None), ("PO1234", [None, None, None, "PO1234"])],
|
||||
)
|
||||
def test_organization_billing_details(purchase_order_number, expected_result):
|
||||
organization = Organization(
|
||||
|
||||
@@ -88,8 +88,8 @@ def test_bad_permission_raises(service_one):
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"purchase_order_number,expected_result",
|
||||
[[None, None], ["PO1234", [None, None, None, "PO1234"]]],
|
||||
("purchase_order_number", "expected_result"),
|
||||
[(None, None), ("PO1234", [None, None, None, "PO1234"])],
|
||||
)
|
||||
def test_service_billing_details(purchase_order_number, expected_result):
|
||||
service = Service(service_json(purchase_order_number=purchase_order_number))
|
||||
|
||||
@@ -31,14 +31,14 @@ def test_can_create_spreadsheet_from_dict_with_filename():
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"args, kwargs",
|
||||
(
|
||||
("args", "kwargs"),
|
||||
[
|
||||
(
|
||||
("hello", ["hello"]),
|
||||
{},
|
||||
),
|
||||
((), {"csv_data": "hello", "rows": ["hello"]}),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_spreadsheet_checks_for_bad_arguments(args, kwargs):
|
||||
with pytest.raises(TypeError) as exception:
|
||||
|
||||
@@ -12,8 +12,8 @@ VIS_PARENT_FOLDER_ID = "bbbb222b-2b22-2b22-222b-b222b22b2222"
|
||||
INV_CHILD_2_FOLDER_ID = "fafe723f-1d39-4a10-865f-e551e03d8886"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_get_hierarchy_of_folders(
|
||||
@pytest.fixture()
|
||||
def _mock_get_hierarchy_of_folders(
|
||||
mock_get_template_folders, active_user_with_permissions
|
||||
):
|
||||
mock_get_template_folders.return_value = [
|
||||
@@ -74,8 +74,8 @@ def mock_get_hierarchy_of_folders(
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("_mock_get_hierarchy_of_folders")
|
||||
def test_template_list_yields_folders_visible_to_user(
|
||||
mock_get_hierarchy_of_folders,
|
||||
mock_get_service_templates,
|
||||
service_one,
|
||||
active_user_with_permissions,
|
||||
@@ -98,8 +98,8 @@ def test_template_list_yields_folders_visible_to_user(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("_mock_get_hierarchy_of_folders")
|
||||
def test_template_list_yields_all_folders_without_user(
|
||||
mock_get_hierarchy_of_folders,
|
||||
mock_get_service_templates,
|
||||
service_one,
|
||||
):
|
||||
|
||||
@@ -57,7 +57,7 @@ def test_activate_user_already_active(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"is_platform_admin, value_in_session, expected_result",
|
||||
("is_platform_admin", "value_in_session", "expected_result"),
|
||||
[
|
||||
(True, True, False),
|
||||
(True, False, True),
|
||||
|
||||
Reference in New Issue
Block a user