def save(self, method):
     """
       1.) Flat FS
       2.) PostgreSQL
     """
     if method == 1:
         self.customer.id = FlatFS("Customer").save(self.customer)
         return self.customer.id
Example #2
0
 def test_read_file_by_id(self):
     flatFS = FlatFS("Tests/Data/File")
     for key, customer in enumerate(self.customers):
         self.customers[key].id = flatFS.save(customer)
     print self.customers[1].__dict__
     print flatFS.get_by_id(2)
     self.assertTrue(flatFS.get_by_id(2) == self.customers[1].__dict__)
Example #3
0
 def test_read_file_with_one_entry(self):
     flatFS = FlatFS("Tests/Data/File")
     self.customers[0].id = flatFS.save(self.customers[0])
     customerDict = self.customers[0].__dict__
     print customerDict
     print flatFS.get_all()[0]
     self.assertTrue(flatFS.get_all()[0] == customerDict)
Example #4
0
 def test_read_empty_file(self):
     flatFS = FlatFS("Tests/Data/File")
     open("Tests/Data/File", "w")
     self.assertTrue(flatFS.get_all() == [])
 def update(self, method):
     if method == 1:
         return FlatFS("Customer").update(self.customer)
 def read(self, id):
     self.customer = FlatFS("Customer").get_by_id(id)
 def get_all_customers(self, method):
     if method == 1:
         return FlatFS("Customer").get_all()