From 9dbc5d5ef85b829894cc2fff900acd780e0673df Mon Sep 17 00:00:00 2001 From: Abhay Rana Date: Sat, 7 Jun 2014 02:51:34 +0530 Subject: [PATCH] Gets Chrome module to a working state - Shifts to using /tmp/hackertray.chrome for no conflicts --- hackertray/chrome.py | 8 +++++--- test/chrome_test.py | 9 ++++----- 2 files changed, 9 insertions(+), 8 deletions(-) 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