def test_get_item(app, client, maintenance_id): # GET /maintenance/{id_} response = get_item(app, client, maintenance_id) maintenance_item = json.loads(response.get_data()) assert maintenance_item["maintenance_id"] == maintenance_id assert validate_uuid(maintenance_item["maintenance_id"], 4) is True assert validate_uuid(maintenance_item["bike_id"], 4) is True for key, value in default_payload_post.items(): assert maintenance_item[key] == value assert response.status_code == 200
def test_get_item(app, client, history_id): # GET /history/{id_} response = get_item(app, client, history_id) history_item = json.loads(response.get_data()) assert history_item["history_id"] == history_id assert validate_uuid(history_item["maintenance_id"], 4) is True assert validate_uuid(history_item["bike_id"], 4) is True for key, value in default_payload_post.items(): if key == "datetime_display": assert history_item[key] == datetime.fromtimestamp(value, tz=timezone.utc).replace(tzinfo=None)\ .isoformat() # this should be unified else: assert history_item[key] == value assert response.status_code == 200
def test_post(app, client): # POST /maintenance/ response = post(app, client) maintenance_id = json.loads(response.get_data()) assert validate_uuid(maintenance_id, 4) is True # response must be a valid uuid4 assert response.status_code == 201
def test_post(app, client): # POST /history/ response = post(app, client) history_id = json.loads(response.get_data()) assert validate_uuid(history_id, 4) is True # response must be a valid uuid4 assert response.status_code == 201
def test_get_item(app, client, coach_id): # GET /coach/{id_} response = get_item(app, client, coach_id) setup_item = json.loads(response.get_data()) assert setup_item["coach_id"] == coach_id assert validate_uuid(setup_item["coach_id"], 4) is True for key, value in default_payload_post.items(): assert setup_item[key] == value assert response.status_code == 200
def test_get_item(app, client, tire_id): # GET /tire/{id_} response = get_item(app, client, tire_id) tire_item = json.loads(response.get_data()) assert tire_item["tire_id"] == tire_id assert validate_uuid(tire_item["tire_id"], 4) is True for key, value in default_payload_post.items(): assert tire_item[key] == value assert response.status_code == 200
def test_put_item(app, client, bike_id): # PUT /bike/{id_} response = put_item(app, client, bike_id) assert response.status_code == 204 response = get_item(app, client, bike_id) bike_item = json.loads(response.get_data()) assert bike_item["bike_id"] == bike_id assert validate_uuid(bike_item["bike_id"], 4) is True for key, value in default_payload_put.items(): assert bike_item[key] == value
def test_put_item(app, client, setup_id): # PUT /setup/{id_} response = put_item(app, client, setup_id) assert response.status_code == 204 response = get_item(app, client, setup_id) setup_item = json.loads(response.get_data()) assert setup_item["setup_id"] == setup_id assert validate_uuid(setup_item["setup_id"], 4) is True for key, value in default_payload_put.items(): if key == "datetime_display": assert setup_item[key] == datetime.fromtimestamp(value, tz=timezone.utc).replace(tzinfo=None)\ .isoformat() # this should be unified else: assert setup_item[key] == value
def test_post(app, client): # POST /sparepartitem/ response = post(app, client) sparepartitem_id = json.loads(response.get_data()) assert validate_uuid(sparepartitem_id, 4) is True # response must be a valid uuid4 assert response.status_code == 201