2016-02-17 21:32:15 +00:00
|
|
|
from src.settings import Settings
|
2016-02-18 12:26:50 +00:00
|
|
|
from src.tox import Tox
|
|
|
|
import sys
|
2016-02-18 16:15:38 +00:00
|
|
|
from src.profile import Profile
|
2016-02-18 12:26:50 +00:00
|
|
|
import os
|
2016-02-17 21:32:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestSettings():
|
2016-02-18 12:26:50 +00:00
|
|
|
|
2016-02-17 21:32:15 +00:00
|
|
|
def test_creation(self):
|
|
|
|
s = Settings()
|
|
|
|
assert s['ipv6_enabled'] is not None
|
|
|
|
assert s['notifications'] is not None
|
2016-02-18 12:26:50 +00:00
|
|
|
|
|
|
|
def test_with_delete(self):
|
|
|
|
path = Settings.get_default_path() + 'toxygen.json'
|
|
|
|
os.remove(path)
|
|
|
|
Settings()
|
|
|
|
assert os.path.exists(path)
|
|
|
|
|
|
|
|
|
|
|
|
class TestTox():
|
|
|
|
|
|
|
|
def test_creation(self):
|
|
|
|
try:
|
|
|
|
tox = Tox('tox_save')
|
|
|
|
assert tox.tox_options is not None
|
|
|
|
del tox
|
|
|
|
except:
|
|
|
|
assert 0
|
|
|
|
|
|
|
|
def test_init(self):
|
|
|
|
try:
|
|
|
|
tox = Tox('tox_save')
|
|
|
|
assert tox.get_savedata_size()
|
|
|
|
except:
|
|
|
|
assert 0
|
2016-02-18 16:15:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestProfile():
|
|
|
|
|
|
|
|
def test_search(self):
|
|
|
|
arr = Profile.find_profiles()
|
|
|
|
assert arr
|
2016-02-18 16:52:12 +00:00
|
|
|
|
|
|
|
def test_open(self):
|
|
|
|
data = Profile.open_profile(Settings.get_default_path(), 'tox_save')
|
|
|
|
assert data
|
|
|
|
|
|
|
|
def test_open_save(self):
|
|
|
|
data = Profile.open_profile(Settings.get_default_path(), 'tox_save')
|
|
|
|
Profile.save_profile(data)
|
|
|
|
new_data = Profile.open_profile(Settings.get_default_path(), 'tox_save')
|
|
|
|
assert new_data == data
|