Esempio n. 1
0
 def test_toggle_alerts_posts_to_expected_url(
         self, mock_session, user_context,
         mock_get_all_cases_response_empty):
     client = DepartingEmployeeClient(mock_session, user_context)
     mock_session.post.return_value = mock_get_all_cases_response_empty
     client.toggle_alerts()
     assert mock_session.post.call_args[0][
         0] == "/svc/api/v1/departingemployee/togglealerts"
Esempio n. 2
0
 def test_toggle_alerts_uses_given_tenant_id_over_current_id(
         self, mock_session, user_context,
         mock_get_all_cases_response_empty):
     client = DepartingEmployeeClient(mock_session, user_context)
     mock_session.post.return_value = mock_get_all_cases_response_empty
     client.toggle_alerts(_TENANT_ID_PARAM)
     post_call_args = json.loads(mock_session.post.call_args[1]["data"])
     assert post_call_args["tenantId"] == _TENANT_ID_PARAM
Esempio n. 3
0
    def test_toggle_alerts_posts_expected_data(
            self, mock_session, user_context,
            mock_get_all_cases_response_empty):
        client = DepartingEmployeeClient(mock_session, user_context)
        mock_session.post.return_value = mock_get_all_cases_response_empty
        client.toggle_alerts()

        # Have to convert the request data to a dict because
        # older versions of Python don't have deterministic order.
        posted_data = json.loads(mock_session.post.call_args[1]["data"])
        assert (posted_data["tenantId"] == TENANT_ID_FROM_RESPONSE
                and posted_data["alertsEnabled"] == True)