def test_credentials(self): """Test that the environment will override a default value for a credential.""" twine = Twine(source=self.VALID_CREDENTIALS_TWINE) with mock.patch.dict( os.environ, { "SECRET_THE_FIRST": "a value", "SECRET_THE_SECOND": "another value", "SECRET_THE_THIRD": "value" }, ): twine.validate_credentials() self.assertEqual(os.environ["SECRET_THE_THIRD"], "value")
def test_missing_credentials(self): """Test that a twine with credentials will not validate where they are missing from the environment""" twine = Twine(source=self.VALID_CREDENTIALS_TWINE) with self.assertRaises(exceptions.CredentialNotFound): twine.validate_credentials()
def test_no_credentials(self): """Test that a twine with no credentials will validate straightforwardly""" twine = Twine(source=VALID_SCHEMA_TWINE) twine.validate_credentials()