Exemple #1
0
def test_delete_two_item(resource):
    user_id = resource
    ItemRepo.add_item(description="This is an item",
                      location="inbox",
                      user=user_id)
    ItemRepo.add_item(description="This is another item",
                      location="inbox",
                      user=user_id)
    items = ItemRepo.get_all_items()
    assert len(items) == 2
    item_id_1 = str(items[0]["id"])
    item_id_2 = str(items[1]["id"])
    assert ItemRepo.delete_item(item_id_1) == True
    assert len(ItemRepo.get_all_items()) == 1
    assert ItemRepo.delete_item(item_id_2) == True
    assert len(ItemRepo.get_all_items()) == 0
Exemple #2
0
def test_delete_item(resource):
    user_id = resource
    ItemRepo.add_item(description="This is an item",
                      location="inbox",
                      user=user_id)
    items = ItemRepo.get_all_items()
    assert len(items) == 1
    item_id = str(items[0]["id"])
    assert ItemRepo.delete_item(item_id) == True
    items = ItemRepo.get_all_items()
    assert len(items) == 0
Exemple #3
0
def item_delete(item_id):
    delete_res = ItemRepo.delete_item(item_id)
    return json.dumps({"success": delete_res})
Exemple #4
0
def test_delete_nonexistent_item(resource):
    user_id = resource
    assert ItemRepo.delete_item("thisisafakeid") == False