Esempio n. 1
0
 def test_get_by_username_posts_to_expected_url(
         self, mock_session, user_context, mock_get_all_cases_response):
     mock_session.post.return_value = mock_get_all_cases_response
     client = DepartingEmployeeClient(mock_session, user_context)
     client.get_by_username("*****@*****.**")
     assert mock_session.post.call_args[0][
         0] == "/svc/api/v1/departingemployee/details"
Esempio n. 2
0
 def test_get_by_username_uses_given_tenant_id_over_current_id(
         self, mock_session, user_context, mock_get_all_cases_response):
     mock_session.post.return_value = mock_get_all_cases_response
     client = DepartingEmployeeClient(mock_session, user_context)
     mock_session.get.return_value = mock_get_all_cases_response
     client.get_by_username("*****@*****.**", _TENANT_ID_PARAM)
     first_call = mock_session.post.call_args_list[0]
     post_call_args = json.loads(first_call[1]["data"])
     assert post_call_args["tenantId"] == _TENANT_ID_PARAM
Esempio n. 3
0
    def test_get_by_username_posts_expected_data(self, mock_session,
                                                 user_context,
                                                 mock_get_all_cases_response):
        mock_session.post.return_value = mock_get_all_cases_response
        client = DepartingEmployeeClient(mock_session, user_context)
        client.get_by_username("*****@*****.**")

        # 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[
                "caseId"] == "20"