def test_updating_a_repository_will_update_repo_path(self): """testing if the environment variable will be updated when the repository path is updated """ from stalker import db, defaults db.setup({'sqlalchemy.url': 'sqlite:///:memory:'}) repo = Repository(name='Test Repo', linux_path='/mnt/T', osx_path='/Volumes/T', windows_path='T:/') db.DBSession.add(repo) db.DBSession.commit() import os self.assertTrue(defaults.repo_env_var_template % {'id': repo.id} in os.environ) # now update the repository test_value = '/mnt/S/' repo.path = test_value # expect the environment variable is also updated self.assertEqual( os.environ[defaults.repo_env_var_template % { 'id': repo.id }], test_value)
def test_updating_a_repository_will_update_repo_path(self): """testing if the environment variable will be updated when the repository path is updated """ from stalker import defaults, Repository repo = Repository(name='Test Repo', linux_path='/mnt/T', osx_path='/Volumes/T', windows_path='T:/') from stalker.db.session import DBSession DBSession.add(repo) DBSession.commit() import os assert defaults.repo_env_var_template % {'id': repo.id} in os.environ # now update the repository test_value = '/mnt/S/' repo.path = test_value # expect the environment variable is also updated assert \ os.environ[defaults.repo_env_var_template % {'id': repo.id}] == \ test_value