

@unittest.skipUnless(RUN_INDEXES, 'RUN_INDEXES is 0')
def test_set_indexes(self):
    if (not self.is_2i_supported()):
        raise unittest.SkipTest('2I not supported')
    bucket = self.client.bucket(self.bucket_name)
    foo = bucket.new('foo', 1)
    foo.indexes = set([('field1_bin', 'test'), ('field2_int', 1337)])
    foo.store()
    result = self.client.index(self.bucket_name, 'field2_int', 1337).run()
    self.assertEqual(1, len(result))
    self.assertEqual('foo', result[0][1])
    result = bucket.get_index('field1_bin', 'test')
    self.assertEqual(1, len(result))
    self.assertEqual('foo', str(result[0]))

dataset/ETHPy150Open basho/riak-python-client/riak/tests/test_2i.py TwoITests.test_set_indexes/original