Exemple #1
0
 def test_loaded_credentials_returns_proper_object(self):
     netrc.netrc = MagicMock(return_value=MockNetrc)
     netrc.netrc.hosts = MagicMock()
     netrc.netrc.return_value.authenticators = MagicMock(return_value=('somelogin', None, 'somepass'))
     with patch.object(FileCredentialsProvider, 'is_exists', return_value=True):
         credentials = FileCredentialsProvider()
         self.assertEquals(credentials.load("https://someurl"),
                           CredentialsData(machine='https://someurl', password='******', username='******'))
Exemple #2
0
 def test_credentials_netrc_exists_but_no_entry_is_found_raises_exception(self):
     with self.assertRaises(Exception):
         with patch('netrc.netrc'):
             credentials = FileCredentialsProvider()
             credentials.load("https://someurl")
Exemple #3
0
 def test_credentials_netrc_exists_but_is_empty_raises_exception(self):
     netrc.netrc = MagicMock(return_value=MockEmptyNetrc)
     with self.assertRaises(Exception):
         credentials = FileCredentialsProvider()
         credentials.load("https://someurl")