Beispiel #1
0
 def test_get_chrome_bookmark_ids(self):
     """Unit test for get_chrome_bookmark_ids()"""
     # does not exist
     # Google Chrome 23 on Windows 8 does not create a bookmarks file on first startup
     # (maybe because the network was disconnected or because user created no bookmarks).
     self.assertEqual(
         [], Special.get_chrome_bookmark_ids('does_not_exist'))
Beispiel #2
0
 def test_get_chrome_bookmark_ids(self):
     """Unit test for get_chrome_bookmark_ids()"""
     # does not exist
     # Google Chrome 23 on Windows 8 does not create a bookmarks file on first startup
     # (maybe because the network was disconnected or because user created no bookmarks).
     self.assertEqual(
         [], Special.get_chrome_bookmark_ids('does_not_exist'))
Beispiel #3
0
    def test_get_chrome_bookmark_urls(self):
        """Unit test for get_chrome_bookmark_urls()"""
        path= self.write_file('bleachbit-test-sqlite', chrome_bookmarks)

        self.assertExists(path)
        urls = Special.get_chrome_bookmark_urls(path)
        self.assertEqual(set(urls), {u'https://www.bleachbit.org/', u'http://www.slashdot.org/'})

        os.unlink(path)
Beispiel #4
0
    def test_get_chrome_bookmark_urls(self):
        """Unit test for get_chrome_bookmark_urls()"""
        path= self.write_file('bleachbit-test-sqlite', chrome_bookmarks)

        self.assertExists(path)
        urls = Special.get_chrome_bookmark_urls(path)
        self.assertEqual(set(urls), {u'https://www.bleachbit.org/', u'http://www.slashdot.org/'})

        os.unlink(path)
Beispiel #5
0
    def test_get_sqlite(self):
        """Unit test for get_sqlite()"""
        sql = """CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
INSERT INTO "meta" VALUES('version','20');
INSERT INTO "meta" VALUES('version_str','aaa');
"""
        # create test file
        filename = self.mkstemp(prefix='bleachbit-test-sqlite')
        FileUtilities.execute_sqlite3(filename, sql)
        self.assertExists(filename)
        # run the test
        ver = Special.get_sqlite(
            filename, 'select value from meta where key="version"')
        self.assertEqual(ver, [20])

        ver = Special.get_sqlite(
            filename, 'select value from meta where key="version_str"', None, str)
        self.assertEqual(ver, ["aaa"])
Beispiel #6
0
    def test_get_sqlite_int(self):
        """Unit test for get_sqlite_int()"""
        sql = """CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
INSERT INTO "meta" VALUES('version','20');"""
        # create test file
        filename = self.mkstemp(prefix='bleachbit-test-sqlite')
        FileUtilities.execute_sqlite3(filename, sql)
        self.assertExists(filename)
        # run the test
        ver = Special.get_sqlite_int(filename, 'select value from meta where key="version"')
        self.assertEqual(ver, [20])
Beispiel #7
0
 def get_commands(self):
     for path in self.get_paths():
         yield Special.delete_mozilla_url_history(path)