Пример #1
0
    def test_peer_credentials(self):
        base = session.SessionBase()
        self.assertIsNone(base.peer_credentials)

        cred = keychain.Credentials('me', keychain.BaseKeypair())

        base = session.SessionBase(peer_credentials=cred)
        self.assertIsInstance(base.peer_credentials, list)

        base = session.SessionBase(peer_credentials=[cred])
        self.assertIsInstance(base.peer_credentials, list)
Пример #2
0
 def test_authentication_error(self, mock_request):
     base = session.SessionBase()
     self.assertRaises(exceptions.InvalidAuthentication,
                       base.make_http_request, "GET",
                       "https://myservice/unauthorized")
Пример #3
0
 def test_invalid_method(self):
     base = session.SessionBase()
     self.assertRaises(TypeError, base.make_http_request, "UNKOWN",
                       "http://localhost:8080")