def test_local_access_token_with_GET_method(self): data = {'code': str(uuid.uuid4()), 'state': str(uuid.uuid4())} # Call tested function with self.assertRaises(HTTPException) as http_error: access_token(self.get_request_mock(data, 'GET')) self.assertEqual(http_error.exception.code, 403) self.assertEqual(http_error.exception.description, 'method POST only')
def test_local_access_token_no_code_no_state(self): data = {} # Call tested function with self.assertRaises(HTTPException) as http_error: access_token(self.get_request_mock(data)) self.assertEqual(http_error.exception.code, 400) self.assertEqual(http_error.exception.description, 'code cannot be null')
def test_local_access_token(self): data = {'code': str(uuid.uuid4()), 'state': str(uuid.uuid4())} # Call tested function json_response = access_token(self.get_request_mock(data)) self.assert_json_response(json_response)