2019-07-26 21:05:58 +00:00
|
|
|
#!/usr/bin/env python3
|
2020-03-04 06:59:29 +00:00
|
|
|
import sys, os, uuid
|
2019-07-26 21:05:58 +00:00
|
|
|
sys.path.append(".")
|
2019-11-21 09:26:23 +00:00
|
|
|
sys.path.append("src/")
|
2020-03-04 06:59:29 +00:00
|
|
|
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
|
|
|
|
print("Test directory:", TEST_DIR)
|
|
|
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
2019-07-26 21:05:58 +00:00
|
|
|
import unittest, uuid
|
|
|
|
from utils import identifyhome
|
|
|
|
|
|
|
|
class IdentifyHomeTest(unittest.TestCase):
|
|
|
|
def test_standard_linux(self):
|
|
|
|
del os.environ["ONIONR_HOME"]
|
|
|
|
self.assertEqual(identifyhome.identify_home(), os.path.expanduser('~') + '/.local/share/onionr/')
|
|
|
|
def test_environ(self):
|
|
|
|
os.environ["ONIONR_HOME"] = "testhome"
|
|
|
|
self.assertEqual(os.getcwd() + "/testhome/", identifyhome.identify_home())
|
|
|
|
|
2019-09-13 02:22:25 +00:00
|
|
|
unittest.main()
|