Beispiel #1
0
    def test_dict_access(self):
        response = {
            'foo': 'bar',
        }

        response_object = IndexingResponse({}, [response])
        self.assertEqual(response_object[0]['foo'], 'bar')

        response_object = MultipleResponse([response])
        self.assertEqual(response_object[0]['foo'], 'bar')

        response_object = MultipleResponse([IndexingResponse({}, [response])])
        self.assertEqual(response_object[0][0]['foo'], 'bar')

        response_object = AddApiKeyResponse({}, response)
        self.assertEqual(response_object['foo'], 'bar')

        response_object = UpdateApiKeyResponse({}, response, {})
        self.assertEqual(response_object['foo'], 'bar')

        response_object = DeleteApiKeyResponse({}, response, '')
        self.assertEqual(response_object['foo'], 'bar')

        response_object = MultipleIndexBatchIndexingResponse({}, response)
        self.assertEqual(response_object['foo'], 'bar')
    def delete_api_key(self, key, request_options=None):
        # type: (str, Optional[Union[dict, RequestOptions]]) -> DeleteApiKeyResponse # noqa: E501

        raw_response = self._transporter.write(Verb.DELETE,
                                               endpoint("1/keys/{}", key),
                                               None, request_options)
        return DeleteApiKeyResponse(self, raw_response, key)
    def test_dict_access(self):
        response = {
            "foo": "bar",
        }

        response_object = IndexingResponse({}, [response])
        self.assertEqual(response_object[0]["foo"], "bar")

        response_object = MultipleResponse([response])
        self.assertEqual(response_object[0]["foo"], "bar")

        response_object = MultipleResponse([IndexingResponse({}, [response])])
        self.assertEqual(response_object[0][0]["foo"], "bar")

        response_object = AddApiKeyResponse({}, response)
        self.assertEqual(response_object["foo"], "bar")

        response_object = UpdateApiKeyResponse({}, response, {})
        self.assertEqual(response_object["foo"], "bar")

        response_object = DeleteApiKeyResponse({}, response, "")
        self.assertEqual(response_object["foo"], "bar")

        response_object = MultipleIndexBatchIndexingResponse({}, response)
        self.assertEqual(response_object["foo"], "bar")