diff --git a/hackertray/chrome.py b/hackertray/chrome.py index b85173c..53cfbed 100644 --- a/hackertray/chrome.py +++ b/hackertray/chrome.py @@ -1,11 +1,12 @@ import sqlite3 import shutil +import os class Chrome: @staticmethod def search(urls, config_folder_path): - HackerNews.setup() - conn = sqlite3.connect('/tmp/chrome') + Chrome.setup(config_folder_path) + conn = sqlite3.connect('/tmp/hackertray.chrome') db = conn.cursor() result = [] for url in urls: @@ -14,7 +15,8 @@ class Chrome: result.append(False) else: result.append(True) + os.remove('/tmp/hackertray.chrome') return result @staticmethod - def setup(): + def setup(config_folder_path): shutil.copyfile(config_folder_path+'/History', '/tmp/hackertray.chrome') \ No newline at end of file diff --git a/test/chrome_test.py b/test/chrome_test.py index 41309b7..554f4f9 100644 --- a/test/chrome_test.py +++ b/test/chrome_test.py @@ -5,13 +5,12 @@ from hackertray import Chrome class ChromeTest(unittest.TestCase): def runTest(self): - self.assertTrue(True) - ''' - config_folder_path = os.getcwd()+'/tests/' - data = GoogleChrome.search([ + config_folder_path = os.getcwd()+'/test/' + print config_folder_path + data = Chrome.search([ "https://github.com/", "https://news.ycombinator.com/", "https://github.com/captn3m0/hackertray", "http://invalid_url/"], config_folder_path) - self.assertTrue(data == [True,True,True,False])''' \ No newline at end of file + self.assertTrue(data == [True,True,True,False]) \ No newline at end of file