mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 01:04:00 -04:00
notify-api-412 use black to enforce python coding style
This commit is contained in:
@@ -9,49 +9,61 @@ def test_client_creates_invite(
|
||||
fake_uuid,
|
||||
sample_invite,
|
||||
):
|
||||
|
||||
mocker.patch('app.notify_client.current_user')
|
||||
mocker.patch("app.notify_client.current_user")
|
||||
|
||||
mock_post = mocker.patch(
|
||||
'app.invite_api_client.post',
|
||||
return_value={'data': dict.fromkeys({
|
||||
'id', 'service', 'from_user', 'email_address',
|
||||
'permissions', 'status', 'created_at', 'auth_type', 'folder_permissions'
|
||||
})}
|
||||
"app.invite_api_client.post",
|
||||
return_value={
|
||||
"data": dict.fromkeys(
|
||||
{
|
||||
"id",
|
||||
"service",
|
||||
"from_user",
|
||||
"email_address",
|
||||
"permissions",
|
||||
"status",
|
||||
"created_at",
|
||||
"auth_type",
|
||||
"folder_permissions",
|
||||
}
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
invite_api_client.create_invite(
|
||||
'12345', '67890', 'test@example.com', {'send_messages'}, 'sms_auth', [fake_uuid]
|
||||
"12345", "67890", "test@example.com", {"send_messages"}, "sms_auth", [fake_uuid]
|
||||
)
|
||||
|
||||
mock_post.assert_called_once_with(
|
||||
url='/service/{}/invite'.format('67890'),
|
||||
url="/service/{}/invite".format("67890"),
|
||||
data={
|
||||
'auth_type': 'sms_auth',
|
||||
'email_address': 'test@example.com',
|
||||
'from_user': '12345',
|
||||
'service': '67890',
|
||||
'created_by': ANY,
|
||||
'permissions': 'send_emails,send_texts',
|
||||
'invite_link_host': 'http://localhost:6012',
|
||||
'folder_permissions': [fake_uuid]
|
||||
}
|
||||
"auth_type": "sms_auth",
|
||||
"email_address": "test@example.com",
|
||||
"from_user": "12345",
|
||||
"service": "67890",
|
||||
"created_by": ANY,
|
||||
"permissions": "send_emails,send_texts",
|
||||
"invite_link_host": "http://localhost:6012",
|
||||
"folder_permissions": [fake_uuid],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_client_returns_invite(mocker, sample_invite):
|
||||
sample_invite["status"] = "pending"
|
||||
service_id = sample_invite["service"]
|
||||
|
||||
sample_invite['status'] = 'pending'
|
||||
service_id = sample_invite['service']
|
||||
expected_data = {"data": [sample_invite]}
|
||||
|
||||
expected_data = {'data': [sample_invite]}
|
||||
expected_url = "/service/{}/invite".format(service_id)
|
||||
|
||||
expected_url = '/service/{}/invite'.format(service_id)
|
||||
|
||||
mock_get = mocker.patch('app.notify_client.invite_api_client.InviteApiClient.get', return_value=expected_data)
|
||||
mock_get = mocker.patch(
|
||||
"app.notify_client.invite_api_client.InviteApiClient.get",
|
||||
return_value=expected_data,
|
||||
)
|
||||
|
||||
invites = invite_api_client.get_invites_for_service(service_id)
|
||||
|
||||
mock_get.assert_called_once_with(expected_url)
|
||||
assert len(invites) == 1
|
||||
assert invites[0]['status'] == 'pending'
|
||||
assert invites[0]["status"] == "pending"
|
||||
|
||||
Reference in New Issue
Block a user