def test_validAuthLoginInfo(self): try: args = Namespace(mica="%s:%s" % (self.SERVER, self.PORT), user='******', password='******') client = MicaClient.build(loginInfo=MicaClient.LoginInfo.parse(args)) self.__sendSimpleRequest(client.new_request()) except Exception, e: self.fail(e)
def test_sendRest(self): try: client = MicaClient.buildWithAuthentication(server="%s:%s" % (self.SERVER, self.PORT), user='******', password='******') self.__sendSimpleRequest(client.new_request()) except Exception, e: self.fail(e)
def test_validSslLoginInfo(self): try: args = Namespace(mica="%s:%s" % (self.SSL_SERVER, self.SSL_PORT), ssl_cert=self.SSL_CERTIFICATE, ssl_key=self.SSL_KEY) client = MicaClient.build(loginInfo=MicaClient.LoginInfo.parse(args)) self.__sendSimpleRequest(client.new_request()) except Exception, e: self.fail(e)
def test_sendSecuredRest(self): try: client = MicaClient.buildWithCertificate(server="%s:%s" % (self.SSL_SERVER, self.SSL_PORT), cert=self.SSL_CERTIFICATE, key=self.SSL_KEY) self.__sendSimpleRequest(client.new_request()) except Exception, e: self.fail(e)
def test_sendRestBadCredentials(self): client = MicaClient.buildWithAuthentication(server="%s:%s" % (self.SERVER, self.PORT), user='******', password='******') self.assertRaises(Exception, self.__sendSimpleRequest, client.new_request())
def test_sendRestBadServer(self): client = MicaClient.buildWithAuthentication(server='http://deadbeef:8080', user='******', password='******') self.assertRaises(Exception, self.__sendSimpleRequest, client.new_request())