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'
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
def test_checkout_equipment(): make_test_file() ft = FTInventory("test.csv") ft.input = lambda _: ('1') ft.checkout_equipment()
def test_write(): ft = FTInventory("test.csv") ft.contents = ["This is a the first line", "this is the 2nd"] ft.write()
def test_read_none(): ft = FTInventory("none.csv") ft.read() assert ft.contents == []
def test_read(): make_test_file() ft = FTInventory("test.csv") ft.read() print(ft.contents[0]) assert ft.contents[1]['Location'] == "TargetA"