def test_add(self): """ depends kind of the previous tests, checks only if the database entry it really done and the file is moved to the storage """ insert = Component.add(self.component) output = Component.get_exactly("example") self.assertEqual(insert, output) # check if component is stored. import os self.assertTrue(os.path.isfile(os.path.join(Database.store, 'example.tgz')))
def test_add(self): """ depends kind of the previous tests, checks only if the database entry it really done and the file is moved to the storage """ insert = Component.add(self.component) output = Component.get_exactly("example") self.assertEqual(insert, output) # check if component is stored. import os self.assertTrue( os.path.isfile(os.path.join(Database.store, 'example.tgz')))
def test_remove(self): """ This Test is a complete test for the removal function. It tests the removal of a database entry as well as the correlated file in the store """ component = Component.add(self.component) component.remove() cursor = Database.db_connection.cursor() cursor.execute("""SELECT * FROM Component WHERE c_id = 'name';""") self.assertTrue(cursor.fetchone() is None, "Removing Entries has failed") import os component_file = os.path.join(Database.store, "example.tgz") self.assertFalse(os.path.isfile(component_file))