예제 #1
0
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
예제 #2
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'
예제 #3
0
 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
예제 #4
0
def test_get_no_item(json_file):
    results = atomic.get_item(str(json_file),
                              "xxxxxxxx-deba-11e8-bded-680715cce955")
    assert not results
예제 #5
0
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'