コード例 #1
0
 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')
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
0
 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')
コード例 #6
0
 def test_create_new_with_name(self):
     DB.create_new('test')
     self.assertTrue(os.path.isfile(os.path.join(self.path, 'test.db')))
コード例 #7
0
 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)
コード例 #8
0
 def test_create_new_without_name(self):
     DB.create_new('')
     self.assertTrue(os.path.isfile(os.path.join(self.path, settings.DB_NAME)))
コード例 #9
0
 def setUp(self):
     super().setUp()
     DB.create_new('test')