def put(self, uuid): if utils.is_file(products_json_file): results = atomic.update_item(str(products_json_file), request.json, str(uuid)) if results: return results, 200 return {"message": "Product not found."}, 404
def get(self, uuid): if utils.is_file(products_json_file): results = atomic.get_item(str(products_json_file), str(uuid)) if results: return results, 200 return {"message": "Product not found."}, 404
def post(self): """Creates a new product.""" if utils.is_file(products_json_file): result = atomic.set_item(str(products_json_file), request.json) if result: return {"message": "Product successfully created."}, 201
def test_is_file_not_ok(): invalid_filename = "tests/data.json" assert not utils.is_file(invalid_filename)
def test_is_file_ok(): invalid_filename = "tests/test_main.py" assert utils.is_file(invalid_filename)