예제 #1
0
def test_item_to_task(resource):
    user_id = resource
    ItemRepo.add_item(description="Thing", location="inbox", user=user_id)
    added_item = ItemRepo.get_all_items()[0]
    task = ItemRepo.item_to_task(added_item["id"], user_id)
    # No more items
    assert len(ItemRepo.get_all_items()) == 0
    # Task used to be the item
    assert task is not None
    assert task["description"] == "Thing"
예제 #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
예제 #3
0
파일: item.py 프로젝트: sirrah23/GTDApp
def item_get():
    uid = current_user.get_obj_id()
    user_items = ItemRepo.get_all_items(user=uid)
    res = {}
    res["success"] = True
    res["data"] = user_items
    return json.dumps(res)
예제 #4
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
예제 #5
0
def test_item_to_project(resource):
    user_id = resource
    item = ItemRepo.add_item(description="Thing",
                             location="inbox",
                             user=user_id)
    project = ItemRepo.item_to_project(item["id"], user_id)
    assert project is not None
    assert len(ItemRepo.get_all_items()) == 0
    assert project["description"] == "Thing"
예제 #6
0
def test_store_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
    assert items[0]["description"] == "This is an item"
    assert items[0]["location"] == "inbox"