def loadObjects(self): # incarca obiectele din fisierul baza de date self.objects = [] dbfile = open(self.database, "r") for line in dbfile: line = line.strip().split(" ") newObj = Object(int(line[0]), line[1], line[2], float(line[3]), line[4]) self.objects.append(newObj) self.ids.append(int(newObj.getId())) dbfile.close()
def testeModificare(logic): # Testeaza functionalitatea de modificare objects = logic.domain.getObjects() obj = Object(objects[0].getId(), objects[0].getNume(), objects[0].getDescriere(), objects[0].getPret(), objects[0].getLocatie()) obj.setNume("testModify") assert objects[0] != obj logic.modifyObject(obj.getId(), obj) objects = logic.domain.getObjects() assert objects[0].getNume() == obj.getNume()