コード例 #1
0
ファイル: tests.py プロジェクト: Web5design/elasticdict
    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"}')
コード例 #2
0
ファイル: tests.py プロジェクト: Web5design/elasticdict
    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"}'
        )