def test_describe_index(self, started_app): collection_name = inspect.currentframe().f_code.co_name index_type = IndexType.FLAT params = {'nlist': 1} index_param = IndexParam(collection_name=collection_name, index_type=index_type, params=params) Parser.parse_proto_CollectionName = mock.MagicMock( return_value=(OK, collection_name)) ServiceHandler._describe_index = mock.MagicMock( return_value=(OK, index_param)) status, ret = self.client.describe_index(collection_name) assert status.OK() assert ret._collection_name == index_param._collection_name Parser.parse_proto_CollectionName = mock.MagicMock( return_value=(BAD, collection_name)) status, _ = self.client.describe_index(collection_name) assert not status.OK()
def test_describe_index(self, started_app): table_name = inspect.currentframe().f_code.co_name index_type = IndexType.FLAT nlist = 1 index_param = IndexParam(table_name=table_name, index_type=index_type, nlist=nlist) Parser.parse_proto_TableName = mock.MagicMock( return_value=(OK, table_name)) ServiceHandler._describe_index = mock.MagicMock( return_value=(OK, index_param)) status, ret = self.client.describe_index(table_name) assert status.OK() assert ret._table_name == index_param._table_name Parser.parse_proto_TableName = mock.MagicMock( return_value=(BAD, table_name)) status, _ = self.client.describe_index(table_name) assert not status.OK()