def test_prefix(self): """Testing: prefix get/set.""" prefix = self.assets + 'pass-store' store = pass_import.PasswordStore(prefix) self.assertEqual(prefix, store.prefix) store.prefix = self.store.prefix self.assertEqual(store.env['PASSWORD_STORE_DIR'], self.store.prefix)
def _tmpdir(self): """Create a temporary test directory named after the testname.""" self.prefix = os.path.join(self.tmp, self._testMethodName) # Set PASSWORD_STORE_DIR & declare a passwordstore object os.environ['PASSWORD_STORE_DIR'] = self.prefix self.store = pass_import.PasswordStore() # Re-initialize the test directory if os.path.isdir(self.prefix): shutil.rmtree(self.prefix, ignore_errors=True) os.makedirs(self.prefix, exist_ok=True)
def setUp(self): # The test name is the test method name after 'test_' testname = self.id().split('.').pop()[len('test_'):] # Set PASSWORD_STORE_DIR & declare a passwordstore object prefix = os.path.join(self.tmp, testname) os.environ['PASSWORD_STORE_DIR'] = prefix self.store = pass_import.PasswordStore() # Re-initialize the test directory if os.path.isdir(prefix): shutil.rmtree(prefix, ignore_errors=True) os.makedirs(prefix, exist_ok=True)
def test_environment_no_prefix(self): """Testing: no prefix.""" os.environ.pop('PASSWORD_STORE_DIR', None) with self.assertRaises(pass_import.PasswordStoreError): pass_import.PasswordStore()
def setUp(self): # Use the password store in tests/pass-store self.prefix = self.assets + 'pass-store' os.environ['PASSWORD_STORE_DIR'] = self.prefix self.store = pass_import.PasswordStore()
def setUp(self): testname = self.id().split('_').pop() + '-store' os.environ['PASSWORD_STORE_DIR'] = os.path.join(self.tmp, testname) os.makedirs(os.environ['PASSWORD_STORE_DIR'], exist_ok=True) self.store = pass_import.PasswordStore()
def setUp(self): """Use the password repository in tests/assets/pass-store.""" self.prefix = os.path.join(tests.assets, 'pass-store') os.environ['PASSWORD_STORE_DIR'] = self.prefix self.store = pass_import.PasswordStore()