Esempio n. 1
0
def test_find_value(app):
    party_id = app.party_id
    name = 'name4'
    value = 'value4'

    value_before_create = settings_service.find_setting_value(party_id, name)
    assert value_before_create is None

    settings_service.create_setting(party_id, name, value)

    value_after_create = settings_service.find_setting_value(party_id, name)
    assert value_after_create == value
Esempio n. 2
0
def test_find(app):
    party_id = app.party_id
    name = 'name3'
    value = 'value3'

    setting_before_create = settings_service.find_setting(party_id, name)
    assert setting_before_create is None

    settings_service.create_setting(party_id, name, value)

    setting_after_create = settings_service.find_setting(party_id, name)
    assert setting_after_create is not None
    assert setting_after_create.party_id == party_id
    assert setting_after_create.name == name
    assert setting_after_create.value == value
Esempio n. 3
0
def test_create(app):
    party_id = app.party_id
    name = 'name1'
    value = 'value1'

    assert settings_service.find_setting(party_id, name) is None

    setting = settings_service.create_setting(party_id, name, value)

    assert setting is not None
    assert setting.party_id == party_id
    assert setting.name == name
    assert setting.value == value
Esempio n. 4
0
def test_get_settings(app):
    party_id = app.party_id

    # Clean up.
    DbSetting.query.delete()

    all_settings_before_create = settings_service.get_settings(party_id)
    assert all_settings_before_create == set()

    for name, value in {
        ('name5a', 'value5a'),
        ('name5b', 'value5b'),
        ('name5c', 'value5c'),
    }:
        settings_service.create_setting(party_id, name, value)

    all_settings_after_create = settings_service.get_settings(party_id)
    assert all_settings_after_create == {
        PartySetting(party_id, 'name5a', 'value5a'),
        PartySetting(party_id, 'name5b', 'value5b'),
        PartySetting(party_id, 'name5c', 'value5c'),
    }