def test_env_nexus_creds(self): os.environ.clear() os.environ.update(self.defaultEnv) context = self.createContext() creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ["NEXUS_PASS"] = "******" os.environ["NEXUS_USER"] = "******" self.assertEqual(creds.load_creds(), ("lame_user", "lame")) self.assertEqual(resolver.resolve_nexus_credentials(), {"user": "******", "password": "******"})
def test_env_nexus_creds(self): os.environ.clear() os.environ.update(self.defaultEnv) config_dir_override = os.path.join(os.path.dirname(__file__), "conf") context = smcontext.SmContext(smcontext.SmApplication(config_dir_override), None, False, False) creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ.setdefault("NEXUS_PASS", "lame") os.environ.setdefault("NEXUS_USER", "lame_user") self.assertEqual(creds.load_creds(), ("lame_user", "lame")) self.assertEqual(resolver.resolve_nexus_credentials(), {"user": "******", "password": "******"})
def test_env_nexus_creds(self): os.environ.clear() os.environ.update(self.defaultEnv) config_dir_override = os.path.join(os.path.dirname(__file__), "conf") context = SmContext(SmApplication(config_dir_override), None, False, False) creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ["NEXUS_PASS"] = "******" os.environ["NEXUS_USER"] = "******" self.assertEqual(creds.load_creds(), ("lame_user", "lame")) self.assertEqual(resolver.resolve_nexus_credentials(), {"user": "******", "password": "******"})
def test_env_nexus_creds(self): os.environ.clear() os.environ.update(self.defaultEnv) context = self.createContext() creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ["NEXUS_PASS"] = "******" os.environ["NEXUS_USER"] = "******" self.assertEqual(creds.load_creds(), ("lame_user", "lame")) self.assertEqual(resolver.resolve_nexus_credentials(), { "user": "******", "password": "******" })
def test_env_nexus_creds_from_config(self): os.environ.clear() os.environ.update(self.defaultEnv) config_dir_override = os.path.join(os.path.dirname(__file__), "conf") context = smcontext.SmContext(smcontext.SmApplication(config_dir_override), None, False, False) context.application.config["nexusPasswordEnvironmentVar"] = "A_FREAKIN_PASS_ENV_VAR" context.application.config["nexusUserEnvironmentVar"] = "A_FREAKIN_USER_ENV_VAR" creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ.setdefault("A_FREAKIN_PASS_ENV_VAR", "lame_from_conf") os.environ.setdefault("A_FREAKIN_USER_ENV_VAR", "lame_user_from_conf") self.assertEqual(creds.load_creds(), ("lame_user_from_conf", "lame_from_conf")) self.assertEqual(resolver.resolve_nexus_credentials(), {"user": "******", "password": "******"})
def test_env_nexus_creds_from_config(self): os.environ.clear() os.environ.update(self.defaultEnv) context = self.createContext() context.application.config["nexusPasswordEnvironmentVar"] = "A_FREAKIN_PASS_ENV_VAR" context.application.config["nexusUserEnvironmentVar"] = "A_FREAKIN_USER_ENV_VAR" creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ.setdefault("A_FREAKIN_PASS_ENV_VAR", "lame_from_conf") os.environ.setdefault("A_FREAKIN_USER_ENV_VAR", "lame_user_from_conf") self.assertEqual(creds.load_creds(), ("lame_user_from_conf", "lame_from_conf")) self.assertEqual(resolver.resolve_nexus_credentials(), {"user": "******", "password": "******"})
def test_env_nexus_creds_from_config(self): os.environ.clear() os.environ.update(self.defaultEnv) config_dir_override = os.path.join(os.path.dirname(__file__), "conf") context = SmContext(SmApplication(config_dir_override), None, False, False) context.application.config["nexusPasswordEnvironmentVar"] = "A_FREAKIN_PASS_ENV_VAR" context.application.config["nexusUserEnvironmentVar"] = "A_FREAKIN_USER_ENV_VAR" creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ.setdefault("A_FREAKIN_PASS_ENV_VAR", "lame_from_conf") os.environ.setdefault("A_FREAKIN_USER_ENV_VAR", "lame_user_from_conf") self.assertEqual(creds.load_creds(), ("lame_user_from_conf", "lame_from_conf")) self.assertEqual(resolver.resolve_nexus_credentials(), {"user": "******", "password": "******"})
def test_env_nexus_creds_from_config(self): os.environ.clear() os.environ.update(self.defaultEnv) context = self.createContext() context.application.config[ "nexusPasswordEnvironmentVar"] = "A_FREAKIN_PASS_ENV_VAR" context.application.config[ "nexusUserEnvironmentVar"] = "A_FREAKIN_USER_ENV_VAR" creds = EnvNexusCredentials(context) resolver = CredentialsResolver(context) os.environ.setdefault("A_FREAKIN_PASS_ENV_VAR", "lame_from_conf") os.environ.setdefault("A_FREAKIN_USER_ENV_VAR", "lame_user_from_conf") self.assertEqual(creds.load_creds(), ("lame_user_from_conf", "lame_from_conf")) self.assertEqual(resolver.resolve_nexus_credentials(), { "user": "******", "password": "******" })