def verify_get_users(): response = requests.get(api_url + '/users', headers={ 'Authorization': 'token %s' % token, }) check_that("response code", response.status_code, equal_to(200)) # check if the response code is 200 response_json = response.json()
def test_return_result(self): lcc.set_step("Get witnesses use 'get_witnesses'") self.send_request(self.get_request(self.__get_witnesses), self.__identifier) resp1 = self.get_response() lcc.set_step("Get witnesses use 'get_witness_by_account'") self.send_request(self.get_request(self.__get_witness_by_account), self.__identifier) resp2 = self.get_response() lcc.set_step( "Check return result methods 'get_witnesses' and 'get_witness_by_account'" ) check_that("test", resp1["result"][0], equal_to(resp2["result"]))
def verify_create_user(): user = User(user_name="Some User", email="*****@*****.**") response = create_user(base_url=Base.USER_BASE_URL, payload=user.get_create_user_payload()) check_that("value", response.status_code, equal_to(200))
def verify_get_user_details(): my_user_id = 1 response = get_user(base_url=Base.USER_BASE_URL, user_id=my_user_id) check_that("value", response.status_code, equal_to(200)) check_that("user_id", response.json()['id'], equal_to(my_user_id))
def verify_get_all_users(): response = get_user(base_url=Base.USER_BASE_URL) num_users = len(response.json()) check_that("value", response.status_code, equal_to(200)) check_that("number of users", num_users, greater_than(0))
def get_response_data_and_validate_response_code_for_negative_test(response): check_that("response code", response.status_code, equal_to(400)) return response.json()["responseData"]
def get_response_data_and_validate_response_code(response): check_that("response code", response.status_code, equal_to(200)) return response.json()["responseData"]
def test_connection_to_registration_api(self): lcc.set_step("Requesting Access to a Registration API") self.__resp = self.get_identifier(self._registration_api) lcc.set_step("Check Registration api identifier") check_that("'registration api identifier'", self.__resp, equal_to(7))
def test_connection_to_crypto_api(self): lcc.set_step("Requesting Access to a Crypto API") self.__resp = self.get_identifier(self._crypto_api) lcc.set_step("Check Crypto api identifier") check_that("'crypto api identifier'", self.__resp, equal_to(6))
def test_connection_to_network_broadcast_api(self): lcc.set_step("Requesting Access to a Network broadcast API") self.__resp = self.get_identifier(self._network_broadcast_api) lcc.set_step("Check Network broadcast api identifier") check_that("'network broadcast api identifier'", self.__resp, equal_to(5))
def test_connection_to_history_api(self): lcc.set_step("Requesting Access to a History API") self.__resp = self.get_identifier(self._history_api) lcc.set_step("Check History api identifier") check_that("'history api identifier'", self.__resp, equal_to(4))
def test_connection_to_asset_api(self): lcc.set_step("Requesting Access to an Asset API") self.__resp = self.get_identifier(self._asset_api) lcc.set_step("Check Asset api identifier") check_that("'asset api identifier'", self.__resp, equal_to(3))
def test_connection_to_db_api(self): lcc.set_step("Requesting Access to a Database API") self.__resp = self.get_identifier(self._database_api) lcc.set_step("Check Database api identifier") check_that("'database api identifier'", self.__resp, equal_to(2))