コード例 #1
0
    def test_retrieve_values_from_keyring_failure(self, monkeypatch):
        def mockreturn(nova_env, param, value):
            return ('useername', False)

        monkeypatch.setattr(credentials, "pull_env_credential", mockreturn)
        nova_env = 'prod'
        nova_creds = {'prod': {'OS_PASSWORD': '******'}}
        with pytest.raises(LookupError) as excinfo:
            credentials.prep_nova_creds(nova_env, nova_creds)
        assert "No matching credentials" in str(excinfo.value)
コード例 #2
0
 def test_retrieve_values_from_keyring_failure(self, monkeypatch):
     def mockreturn(nova_env, param, value):
         return ('useername', False)
     monkeypatch.setattr(credentials, "pull_env_credential", mockreturn)
     nova_env = 'prod'
     nova_creds = {
         'prod': {
             'OS_PASSWORD': '******'
         }
     }
     with pytest.raises(LookupError) as excinfo:
         credentials.prep_nova_creds(nova_env, nova_creds)
     assert "No matching credentials" in str(excinfo.value)
コード例 #3
0
 def test_retrieve_values_from_keyring(self):
     nova_env = 'prod'
     nova_creds = {'prod': {'OS_PASSWORD': '******'}}
     result = credentials.prep_nova_creds(nova_env, nova_creds)
     if six.PY3:
         assert result[0][1] == b"password from TestKeyring"
     else:
         assert result[0][1] == "password from TestKeyring"
コード例 #4
0
 def test_uppercase_credentials(self):
     nova_env = 'prod'
     nova_creds = {
         'prod': {
             'key': 'value'
         }
     }
     result = credentials.prep_nova_creds(nova_env, nova_creds)
     assert result[0][0] == 'KEY'
コード例 #5
0
 def test_lowercase_credentials(self):
     nova_env = 'prod'
     nova_creds = {
         'prod': {
             'http_proxy': 'value'
         }
     }
     result = credentials.prep_nova_creds(nova_env, nova_creds)
     assert result[0][0] == 'http_proxy'
コード例 #6
0
 def test_retrieve_values_from_keyring(self):
     nova_env = 'prod'
     nova_creds = {
         'prod': {
             'OS_PASSWORD': '******'
         }
     }
     result = credentials.prep_nova_creds(nova_env, nova_creds)
     if six.PY3:
         assert result[0][1] == b"password from TestKeyring"
     else:
         assert result[0][1] == "password from TestKeyring"
コード例 #7
0
 def test_lowercase_credentials(self):
     nova_env = 'prod'
     nova_creds = {'prod': {'http_proxy': 'value'}}
     result = credentials.prep_nova_creds(nova_env, nova_creds)
     assert result[0][0] == 'http_proxy'
コード例 #8
0
 def test_uppercase_credentials(self):
     nova_env = 'prod'
     nova_creds = {'prod': {'key': 'value'}}
     result = credentials.prep_nova_creds(nova_env, nova_creds)
     assert result[0][0] == 'KEY'
コード例 #9
0
 def test_invalid_environment(self):
     nova_env = "non-existent"
     nova_creds = {'dfw': None}
     with pytest.raises(KeyError) as excinfo:
         credentials.prep_nova_creds(nova_env, nova_creds)
     assert "was not found" in str(excinfo.value)
コード例 #10
0
 def test_invalid_environment(self):
     nova_env = "non-existent"
     nova_creds = {'dfw': None}
     with pytest.raises(KeyError) as excinfo:
         credentials.prep_nova_creds(nova_env, nova_creds)
     assert "was not found" in str(excinfo.value)