Esempio n. 1
0
def test_searches_configs_config_allowed_kwargs_and_kwargs():
    from snovault.elasticsearch.searches.configs import Config
    c = Config(allowed_kwargs=['first_thing'],
               other_thing='abc',
               something_else=True)
    assert c._allowed_kwargs == ['first_thing']
    assert c._kwargs == {'other_thing': 'abc', 'something_else': True}
Esempio n. 2
0
def test_searches_configs_config_getitem():
    from snovault.elasticsearch.searches.configs import Config
    c = Config(allowed_kwargs=['first_thing', 'other_thing'],
               other_thing='abc',
               something_else=True)
    assert c['other_thing'] == 'abc'
    with pytest.raises(KeyError):
        c['nothing']
Esempio n. 3
0
def test_searches_configs_config_len():
    from snovault.elasticsearch.searches.configs import Config
    c = Config(allowed_kwargs=['first_thing', 'other_thing'],
               other_thing='abc',
               something_else=True)
    assert len(c) == 1
Esempio n. 4
0
def test_searches_configs_config_iter():
    from snovault.elasticsearch.searches.configs import Config
    c = Config(allowed_kwargs=['first_thing', 'other_thing'],
               other_thing='abc',
               something_else=True)
    assert {k: v for k, v in c.items()} == {'other_thing': 'abc'}
Esempio n. 5
0
def test_searches_configs_config_filtered_kwargs():
    from snovault.elasticsearch.searches.configs import Config
    c = Config()
    assert c._filtered_kwargs() == {}
    c = Config(allowed_kwargs=['first_thing'],
               other_thing='abc',
               something_else=True)
    assert c._filtered_kwargs() == {}
    c = Config(allowed_kwargs=['first_thing', 'other_thing'],
               other_thing='abc',
               something_else=True)
    assert c._filtered_kwargs() == {'other_thing': 'abc'}
    c = Config(allowed_kwargs=['first_thing', 'other_thing'],
               other_thing=None,
               something_else=True)
    assert c._filtered_kwargs() == {}
Esempio n. 6
0
def test_searches_configs_config_init():
    from snovault.elasticsearch.searches.configs import Config
    c = Config()
    assert isinstance(c, Config)
Esempio n. 7
0
def test_searches_configs_config_kwargs():
    from snovault.elasticsearch.searches.configs import Config
    c = Config()
    assert c._kwargs == {}
    c = Config(other_thing='abc', something_else=True)
    assert c._kwargs == {'other_thing': 'abc', 'something_else': True}
Esempio n. 8
0
def test_searches_configs_config_allowed_kwargs():
    from snovault.elasticsearch.searches.configs import Config
    c = Config()
    assert c._allowed_kwargs == []
    c = Config(allowed_kwargs=['size'])
    assert c._allowed_kwargs == ['size']