def test_update_plant_missing_family(test_plants_data, test_cu_plant_data): del test_cu_plant_data['family'] with pytest.raises(ApiException) as excinfo: update_plant(test_plants_data, 1, test_cu_plant_data) assert 'family' in excinfo.value.message assert excinfo.value.status == 400
def test_update_plant_invalid_genus(test_plants_data, test_cu_plant_data, test_value): test_cu_plant_data['genus'] = test_value with pytest.raises(ApiException) as excinfo: update_plant(test_plants_data, 1, test_cu_plant_data) assert 'genus' in excinfo.value.message assert excinfo.value.status == 400
def test_update_plant(test_plants_data, test_cu_plant_data): plant = update_plant(test_plants_data, 1, test_cu_plant_data) assert plant['plant_id'] == 1 del plant['plant_id'] assert plant == test_cu_plant_data
def test_update_plant_not_found(test_plants_data, test_cu_plant_data): with pytest.raises(ApiException) as excinfo: update_plant(test_plants_data, 4, test_cu_plant_data) assert excinfo.value.message == 'Not Found' assert excinfo.value.status == 404
def put(self, plant_id): validate_body(request.json) return ApiResult(data_logic.update_plant(plants_data, plant_id, request.json))