Gets Chrome module to a working state

- Shifts to using /tmp/hackertray.chrome for no conflicts
This commit is contained in:
Abhay Rana 2014-06-07 02:51:34 +05:30
parent 0586db9d72
commit 9dbc5d5ef8
2 changed files with 9 additions and 8 deletions

View File

@ -1,11 +1,12 @@
import sqlite3 import sqlite3
import shutil import shutil
import os
class Chrome: class Chrome:
@staticmethod @staticmethod
def search(urls, config_folder_path): def search(urls, config_folder_path):
HackerNews.setup() Chrome.setup(config_folder_path)
conn = sqlite3.connect('/tmp/chrome') conn = sqlite3.connect('/tmp/hackertray.chrome')
db = conn.cursor() db = conn.cursor()
result = [] result = []
for url in urls: for url in urls:
@ -14,7 +15,8 @@ class Chrome:
result.append(False) result.append(False)
else: else:
result.append(True) result.append(True)
os.remove('/tmp/hackertray.chrome')
return result return result
@staticmethod @staticmethod
def setup(): def setup(config_folder_path):
shutil.copyfile(config_folder_path+'/History', '/tmp/hackertray.chrome') shutil.copyfile(config_folder_path+'/History', '/tmp/hackertray.chrome')

View File

@ -5,13 +5,12 @@ from hackertray import Chrome
class ChromeTest(unittest.TestCase): class ChromeTest(unittest.TestCase):
def runTest(self): def runTest(self):
self.assertTrue(True) config_folder_path = os.getcwd()+'/test/'
''' print config_folder_path
config_folder_path = os.getcwd()+'/tests/' data = Chrome.search([
data = GoogleChrome.search([
"https://github.com/", "https://github.com/",
"https://news.ycombinator.com/", "https://news.ycombinator.com/",
"https://github.com/captn3m0/hackertray", "https://github.com/captn3m0/hackertray",
"http://invalid_url/"], "http://invalid_url/"],
config_folder_path) config_folder_path)
self.assertTrue(data == [True,True,True,False])''' self.assertTrue(data == [True,True,True,False])