Example #1
0
        async def async_test_get(loop, client):

            api_client = ApiRestClient(host="localhost", port=8080)
            api_client.session = client
            api_client.base_url = ""

            result = await api_client.get("/test")
            self.assertEqual("get_text", result.text)
Example #2
0
        async def async_test_delete(loop, client):

            api_client = ApiRestClient(host="localhost", port=8080)
            api_client.session = client
            api_client.base_url = ""

            payload = {"this": "is", "a": "test", "payload": 5}

            result = await api_client.delete("/test", payload=payload)
            self.assertEqual(payload, result.json)
        async def async_test_put(loop, client):
            api_client = ApiRestClient(host="localhost", port=8080)
            api_client.session = client
            api_client.base_url = ""

            payload = {"status": "success", "text": "test text", "payload": None}

            result = await api_client.put("/test", payload=payload)
            self.assertEqual(payload["status"], result.status)
            self.assertEqual(payload["text"], result.text)
            self.assertEqual(payload["payload"], result.json)