예제 #1
0
 def test_missing_credential_file(self):
     with self.assertRaises(FileNotFoundError):
         Credentials("nonexistant.yaml")
예제 #2
0
 def test_bad_yaml_file(self):
     with self.assertRaises(yaml.YAMLError):
         Credentials("bad_yaml_file.yaml")
예제 #3
0
 def test_bad_permissions_file(self):
     with self.assertRaises(PermissionError):
         Credentials("bad_permissions.yaml")
예제 #4
0
 def test_bad_dir(self):
     os.environ["IIP_CREDENTIAL_DIR"] = os.path.join(self.package, "tests", "files", "nothing")
     with self.assertRaises(PermissionError):
         Credentials("iip_cred.yaml")
예제 #5
0
 def test_missing_credentials(self):
     del os.environ["IIP_CREDENTIAL_DIR"]
     os.environ["HOME"] = "/tmp"
     with self.assertRaises(PermissionError):
         Credentials("iip_cred.yaml")
     del os.environ["HOME"]
예제 #6
0
 def test_credentials(self):
     cred = Credentials("iip_cred.yaml")
     self.assertEqual(cred.getUser("service_user"), "fakeuser")
     self.assertEqual(cred.getPasswd("service_passwd"), "fakepass")
예제 #7
0
파일: base.py 프로젝트: lsst-dm/dm_csc_base
 def __init__(self, name, config_filename, log_filename):
     self._name = name
     self._config = self.loadConfigFile(config_filename)
     self.setupLogging(log_filename)
     self._cred = Credentials('iip_cred.yaml')