def setUp(self): super().setUp() DB.create_new('test') self.db_path = os.path.join(self.path, 'test.db') self.entry = Entry(id_=123, author='test_author', date='test_date', body='test_body', body_html='test_body_html', url='test_url', plus='1000', media_url='test_media_url', tags=' testtag1 testtag2 ', is_nsfw=False, entry_id=None, type_='entry')
def setUp(self): super().setUp() DB.create_new('test') with DB.Connect() as cursor: DB.insert_one(cursor, self.entry) self.entry.id_ = 2 self.entry.entry_id = 1 self.entry.type_ = 'entry_comment' DB.insert_one(cursor, self.entry)
def setUp(self): super().setUp() DB.create_new('test') with DB.Connect() as cursor: DB.insert_one(cursor, self.entry) self.entry.id_ = 2 DB.insert_one(cursor, self.entry) self.entry.id_ = 3 self.entry.tags = ' differenttag ' DB.insert_one(cursor, self.entry)
def setUp(self): super().setUp() DB.create_new('test') with DB.Connect() as cursor: DB.insert_one(cursor, self.entry) self.entry.id_ = 2 self.entry.tags = ' testtag2 ' DB.insert_one(cursor, self.entry) for e_id in (1, 2): for i in range(1, 4): self.entry.id_ = i + e_id * 4 # fix for different ids self.entry.entry_id = e_id self.entry.type_ = 'entry_comment' DB.insert_one(cursor, self.entry)
def test_if_tables_are_correct(self): DB.create_new('test') connection = sqlite3.connect(os.path.join(self.path, 'test.db')) connection.execute('SELECT * FROM entry') connection.execute('SELECT * FROM entry_comment')
def test_create_new_with_name(self): DB.create_new('test') self.assertTrue(os.path.isfile(os.path.join(self.path, 'test.db')))
def test_if_result_correct(self): DB.create_new('test1') DB.create_new('test2') result = database_list(self.path) self.assertTrue('test1.db' in result) self.assertTrue('test2.db' in result)
def test_create_new_without_name(self): DB.create_new('') self.assertTrue(os.path.isfile(os.path.join(self.path, settings.DB_NAME)))
def setUp(self): super().setUp() DB.create_new('test')