Ejemplo n.º 1
0
 def test_retrieve_invalid_user(self):
     """
     Request for invalid user by passing invalid user id and validate status code.
     :return: None
     """
     resp_obj = UserEndpoint.get_user_list(self.invalid_specific_user_url)
     self.assertEqual(resp_obj['resp_obj'].status_code, 404,'Validate endpoint action with non existing user id.')
Ejemplo n.º 2
0
 def test_get_users_list_page(self):
     """
     Request for users list on the basis of page number and validate status code.
     :return: None
     """
     resp_obj = UserEndpoint.get_user_list(self.users_url_with_page)
     self.assertEqual(resp_obj['resp_obj'].status_code, 200, 'Invalid URL - {}'.format(self.users_url_with_page))
Ejemplo n.º 3
0
 def test_retrieve_specific_user(self):
     """
     Request for specific user and validate status code and data.
     :return:None
     """
     resp_obj = UserEndpoint.get_user_list(self.specific_user_url)
     self.assertEqual(resp_obj['resp_obj'].status_code, 200, 'Invalid url - {}'.format(self.specific_user_url))
     self.assertEqual(resp_obj['resp_data']['data'], self.specific_user_data,
                      'Retrieved data is not matching with expected data.')
Ejemplo n.º 4
0
 def test_get_users_list(self):
     """
     Request for users list and validate status code, user related data fields
     and number of user data matching with data count.
     :return: None
     """
     resp_obj = UserEndpoint.get_user_list(self.users_url)
     self.assertEqual(resp_obj['resp_obj'].status_code, 200, 'Invalid URL - {}'.format(self.users_url))
     self.assertGreater(len(resp_obj['resp_data']['data']), 0, 'No user exists in the database.')
     user_keys = list(resp_obj['resp_data']['data'][0].keys())
     self.assertEqual(self.users_list_keys, user_keys, 'users key values is not matching with expected values.')
     self.assertEqual(int(resp_obj['resp_data']['per_page']), len(resp_obj['resp_data']['data']),
                      'Number of user entires are not matching with per page count.')