def test_07_post_terminal_config(self): # post the config to the server http_rsp = post_json_req(terminal_config_url, json.dumps(terminal_config)) # config should have been created and status code should be 201 assert http_rsp.status_code == 201 # construct the config id device_type = terminal_config["terminalType"] serial_number = terminal_config["serialNumber"] config_id = device_type + serial_number # config should be retrievable from the db config = db.get_value(config_id) assert config is not None http_rsp = post_json_req(terminal_config_url, json.dumps(terminal_config)) # config should already exist and status code should be 409 (conflict) assert http_rsp.status_code == 409
def exists(key): value = db.get_value(key) return value is not None