Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 def test_no_credentials(self):
     """Test that a twine with no credentials will validate straightforwardly"""
     twine = Twine(source=VALID_SCHEMA_TWINE)
     twine.validate_credentials()