def test__setitem__(self): d = ElasticDict() d['foo'] = 'bar' # Set an item # super calls __setitem__(key, value); so we get keys/values just like # a regular dictionary eq_(d.values(), ['bar']) eq_(d.keys(), ['foo']) # Then the key/value is json-ified and posted to ElasticSearch self.mock_requests.post.assert_called_once_with( "http://localhost:9200/elasticdict/data/foo", data='{"foo": "bar"}')
def test__setitem__(self): d = ElasticDict() d['foo'] = 'bar' # Set an item # super calls __setitem__(key, value); so we get keys/values just like # a regular dictionary eq_(d.values(), ['bar']) eq_(d.keys(), ['foo']) # Then the key/value is json-ified and posted to ElasticSearch self.mock_requests.post.assert_called_once_with( "http://localhost:9200/elasticdict/data/foo", data='{"foo": "bar"}' )