Esempio n. 1
0
 def test_update_auth_details(self):
     auth_details = configauth.AuthDetails()
     with self.agent_file() as agent_file_name:
         configauth.update_auth_details_from_agent_file(
             agent_file_name, auth_details)
     self.assertEqual(auth_details.url, "http://example.com:1234")
     self.assertEqual(auth_details.user, "user@admin")
     self.assertEqual(auth_details.key, "private-key")
Esempio n. 2
0
    def test_update_auth_details(self):
        auth_details = configauth.AuthDetails()
        config = {
            'key': {
                'public': 'public-key',
                'private': 'private-key'
            },
            'agents': [{
                'url': 'http://example.com:1234',
                'username': '******'
            }]
        }
        with tempfile.NamedTemporaryFile(mode='w+') as agent_file:
            json.dump(config, agent_file)
            agent_file.flush()

            configauth.update_auth_details_from_agent_file(
                agent_file.name, auth_details)
            self.assertEqual(auth_details.url, 'http://example.com:1234')
            self.assertEqual(auth_details.user, 'user@admin')
            self.assertEqual(auth_details.key, 'private-key')