hackertray/test/firefox_test.py

33 lines
1.1 KiB
Python
Raw Normal View History

2014-10-03 10:56:20 +00:00
import unittest
import os
import pathlib
from pathlib import Path
2014-10-03 10:56:20 +00:00
from hackertray import Firefox
class FirefoxTest(unittest.TestCase):
def test_history(self):
2014-10-03 10:56:20 +00:00
config_folder_path = os.getcwd()+'/test/'
data = Firefox.search([
"http://www.hckrnews.com/",
"http://www.google.com/",
"http://wiki.ubuntu.com/",
"http://invalid_url/"],
config_folder_path)
self.assertTrue(data == [True,True,True,False])
def test_default(self):
test_default_path = Path.home().joinpath(".mozilla/firefox/x0ran0o9.default")
if(os.environ.get('TRAVIS') == 'true'):
2020-06-14 19:00:05 +00:00
if not os.path.exists(str(test_default_path)):
os.makedirs(str(test_default_path))
with open(str(Path.home().joinpath('.mozilla/firefox/profiles.ini')), 'w') as f:
f.write("""
[Profile1]
Name=default
IsRelative=1
Path=x0ran0o9.default
Default=1
""")
2020-06-14 19:00:05 +00:00
self.assertTrue(Firefox.default_firefox_profile_path()==str(Path.home().joinpath(".mozilla/firefox/x0ran0o9.default")))