Пример #1
0
 def test_create_batch_and_retrieve_limit(self):
     table_name = 'password_db'
     table_model = DataModel(table_name, PasswordData)
     table_model.new_table()
     l = []
     for x in range(0, 5):
         l.append(PasswordData('111' + str(x), '222'))
     table_model.create_batch(l)
     self.assertEqual(table_model.retrieve("name", "1110"), PasswordData('1110', '222'))
     self.assertEqual(table_model.retrieve("name", "1114"), PasswordData('1114', '222'))
     self.assertEqual(len(table_model.retrieve_limit(1, 3)), 3)
     os.remove("./password_db.db")
Пример #2
0
 def test_update(self):
     table_name = 'password_db'
     table_model = DataModel(table_name, PasswordData)
     table_model.new_table()
     l = []
     for x in range(1, 6):
         l.append(PasswordData('No' + str(x), str(x)))
     table_model.create_batch(l)
     row_size = table_model.update("name", "No3", "password", "new_password")
     self.assertEqual(row_size, 1)
     row_size = table_model.update("name", "No8", "password", "new_password")
     self.assertEqual(row_size, 0)
     os.remove("./password_db.db")