def asserts_user_get_id_result(self, user_id, user_name, user_email): response = RequestsClient().get(self.url + '{id}/'.format(id=user_id)) response_data = response.json() self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response_data['id'], user_id) self.assertEqual(response_data['name'], user_name) self.assertEqual(response_data['email'], user_email)
def asserts_event_data_get_id_result(self, event_data_id, event_data, event_data_datetime): response = RequestsClient().get(self.url + '{id}/'.format(id=event_data_id)) response_data = response.json() self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response_data['id'], event_data_id) self.assertEqual(response_data['event'], event_data) self.assertEqual(response_data['dateTime'], event_data_datetime) self.assertEqual(response_data['user'], self.user.id)
def test_user_get(self): response = RequestsClient().get(self.url) response_data = response.json() self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertTrue(len(response_data), User.objects.count())
def test_data_treat_get(self): response = RequestsClient().get(self.url) response_result = response.json() self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertJSONEqual(json.dumps(response_result), json.dumps(self.expected_response))