Beispiel #1
0
    def test_do_get(self):
        httpretty.register_uri(httpretty.GET,
                               self.uri,
                               status=self.status_ok,
                               body=json.dumps(self.resp))
        cert_store = Client(self.apikey, self.cert_path, self.uri)
        cert_store.set_url()
        result = cert_store.do_get(self.header)
        self.assertEqual(self.status_ok, result.status_code)
        content = json.loads(result.content)
        self.assertEqual(0, content["ErrCode"])

        httpretty.disable()
        httpretty.reset()
Beispiel #2
0
    def test_do_get(self):
        httpretty.register_uri(httpretty.GET,
                               self.uri,
                               status=self.status_ok,
                               body=json.dumps(self.resp))
        cert_store = Client(
            self.apikey,
            #self.cert_path,
            self.sig_param,
            self.uri,
            True,
            cert=('./tls/client.pem', './tls/client.key'),
            cacert='./tls/ca.crt')
        # cert_store.set_url()
        result = cert_store.do_get(self.uri, self.header)
        self.assertEqual(self.status_ok, result.status_code)
        content = json.loads(result.content)
        self.assertEqual(0, content["ErrCode"])

        httpretty.disable()
        httpretty.reset()