def test_update_item(json_file): mod_item = {'price': 777.0, 'name': "Test Product via update_item"} results = atomic.update_item(str(json_file), mod_item, "1144d69e-joya-33e8-bdfd-680688cce955") results_get = atomic.get_item(str(json_file), "1144d69e-joya-33e8-bdfd-680688cce955") assert results assert results_get[0]["name"] == 'Test Product via update_item' assert results_get[0]["price"] == 777.0
def test_set_item(json_file): new_item = { 'uuid': "1144d69e-joya-33e8-bdfd-680688cce955", 'price': 333.0, 'name': "Test Product via set_item" } results = atomic.set_item(str(json_file), new_item) results_get = atomic.get_item(str(json_file), "1144d69e-joya-33e8-bdfd-680688cce955") assert results assert results_get[0]["name"] == 'Test Product via set_item'
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 test_get_no_item(json_file): results = atomic.get_item(str(json_file), "xxxxxxxx-deba-11e8-bded-680715cce955") assert not results
def test_get_item(json_file): results = atomic.get_item(str(json_file), "2299d69e-deba-11e8-bded-680715cce955") assert results assert results[0]["name"] == 'Test Product'