Exemplo n.º 1
0
def test_append():
    make_test_file()
    ft = FTInventory("test.csv")
    ft.append({"FTID": "FT2222", "Nomen": "printer", "Asset Tag": None,
        "Location": "TargetA","Name": None,"Checked Out Date": None})
    print(ft.contents[2])
    assert ft.contents[2]['Nomen'] == 'printer'
Exemplo n.º 2
0
def test_del_equipment():
    make_test_file()
    ft = FTInventory("test.csv")
    with open('test.csv') as f:
        count = sum(1 for _ in f)
    ft.input = lambda _: ('1')
    ft.del_equipment()
    with open('test.csv') as f:
        count1 = sum(1 for _ in f)
    assert count1 == count -1 
Exemplo n.º 3
0
def test_checkout_equipment():
    make_test_file()
    ft = FTInventory("test.csv")
    ft.input = lambda _: ('1')
    ft.checkout_equipment()
Exemplo n.º 4
0
def test_write():
    ft = FTInventory("test.csv")
    ft.contents = ["This is a the first line", "this is the 2nd"]
    ft.write()
Exemplo n.º 5
0
def test_read_none():
    ft = FTInventory("none.csv")
    ft.read()
    assert ft.contents == []
Exemplo n.º 6
0
def test_read():
    make_test_file()
    ft = FTInventory("test.csv")
    ft.read()
    print(ft.contents[0])
    assert ft.contents[1]['Location'] == "TargetA"