def test_create(): set_up() Create.run(mock_options) path = os.path.join(settings.get('path'), 'test') assert os.path.isdir(path) assert os.path.isfile(os.path.join(path, 'ipython_config.py')) tear_down()
def test_delete_active(): set_up() Create.run(mock_options_4) assert settings.get('active') == 'test' Delete.run(mock_options_2) assert settings.get('active') is None tear_down()
def test_check_dirs(): set_up() Create.run(mock_options) path = join(settings.get('path'), 'test') profile_dir = IProfileDir.find_profile_dir(path) shutil.rmtree(profile_dir.startup_dir, ignore_errors=True) profile_dir.check_dirs() assert isfile(join(profile_dir.startup_dir, '00_config.ipy')) assert isfile(join(profile_dir.startup_dir, '01_scripts.py')) tear_down()
def test_delete(): set_up() Create.run(mock_options) settings.update({ 'path': 'append_test' }).save() Create.run(mock_options) settings.update({ 'path': 'iprofiles' }).save() Delete.run(mock_options) assert not os.path.isdir(os.path.join(settings.get('path'), 'test')) tear_down()
def test_shell(monkeypatch): mock(monkeypatch) set_up() settings.update({ 'path': 'append_test' }).save() Create.run(mock_options) settings.update({ 'path': 'iprofiles' }).save() Shell.run(mock_options) Shell.run(mock_options_2) tear_down()
def test_icommand_list_profiles(): set_up() settings.update({ 'path': 'append_test' }).save() Create.run(mock_options) settings.update({ 'path': 'iprofiles' }).save() cmd = ICommand(_autorun=False) cmd.settings = settings cmd.list_profiles('iprofiles') tear_down()
def test_active(): set_up() Create.run(mock_options) settings.update({ 'path': 'append_test' }).save() Create.run(mock_options) settings.update({ 'path': 'iprofiles' }).save() Activate.run(mock_options) Active.run({}) Activate.run(mock_options_2) Active.run({}) tear_down()
def test_shell_active(monkeypatch): mock(monkeypatch) set_up() Create.run(mock_options_create) Shell.run(mock_options_1) settings.update({ 'path': 'append_test' }).save() Create.run(mock_options_create) settings.update({ 'path': 'iprofiles' }).save() Activate.run(mock_options_2) Shell.run(mock_options_1) tear_down()
def test_list_names_only(): set_up() Create.run(mock_options) Create.run(mock_options_1) Create.run(mock_options_2) List.run({}) tear_down()
def test_django_invalid_settings(monkeypatch): mock_raises(monkeypatch) set_up() Create.run(mock_options_create) Django.run(mock_options_1) tear_down()
def test_init_profiles_exists(): Init.run(mock_options_1) Create.run(mock_options_3) os.remove('iprofile.yml') Init.run(mock_options_1) tear_down()
def test_activate(): set_up() Create.run(mock_options) Activate.run(mock_options) assert settings.get('active') == 'test' tear_down()
def test_invalid_profile(): set_up() Create.run(mock_options) Create.run(mock_options) tear_down()
def test_invalid_name(): set_up() Create.run(mock_options_1) assert not os.listdir(settings.get('path')) tear_down()
def test_delete_confirm_false(monkeypatch): mock(monkeypatch) set_up() Create.run(mock_options) Delete.run(mock_options_3) tear_down()
def test_init_active(): Init.run(mock_options_1) Create.run(mock_options_3) os.remove('iprofile.yml') Init.run(mock_options_2) tear_down()
def test_django(monkeypatch): mock(monkeypatch) set_up() Create.run(mock_options_create) Django.run(mock_options) tear_down()
def test_list_active_profile(): set_up() Create.run(mock_options_3) List.run({}) tear_down()
def test_deactivate(): set_up() Create.run(mock_options) Deactivate.run({}) assert settings.get('active') is None tear_down()