@@ -0,0 +1,2210 @@
+from flask import url_for%0A%0Aimport pytest%0A%0Aimport roomcontrol.utils.localstorage as ls%0A%0A%0ATEST_FILE = %22%22%22%0A%5Bsettings%5D%0Aserverip=0.0.0.0%0Anotify=False%0Asendpic=True%0A%22%22%22%0A%0A%0A@pytest.fixture%0Adef storage_file(tmpdir):%0A    p = tmpdir.join('test_storage.in')%0A    p.write(TEST_FILE)%0A    ls.set_storage_file(str(p))%0A%0A%0Adef test_response_get_settings(storage_file, client):%0A    assert client.get(url_for('main.settings')).status_code == 200%0A%0A%0Adef test_get_returns_right_vals(storage_file, client):%0A    res = client.get(url_for('main.settings'))%0A    assert res.json == %7B%0A        'serverip': '0.0.0.0',%0A        'notify': 'False',%0A        'sendpic': 'True'%0A    %7D%0A%0A%0Adef test_post_response_ok(storage_file, client):%0A    res = client.post(%0A        url_for('main.settings'),%0A        data='%7B%7D',%0A        headers=%7B'Content-Type': 'application/json'%7D)%0A    assert res.status_code == 200%0A%0A%0Adef test_post_response_sends_ok_message(storage_file, client):%0A    res = client.post(%0A        url_for('main.settings'),%0A        data='%7B%7D',%0A        headers=%7B'Content-Type': 'application/json'%7D)%0A    assert res.data == b'settings updated'%0A%0A%0Adef test_post_updates_all_fields(storage_file, client):%0A    client.post(%0A        url_for('main.settings'),%0A        data='%7B%22serverip%22: %22127.0.0.1%22, %22notify%22: true, %22sendpic%22: false%7D',%0A        headers=%7B'Content-Type': 'application/json'%7D)%0A    settings = ls.get_all('settings')%0A    assert settings%5B'serverip'%5D == '127.0.0.1'%0A    assert settings%5B'notify'%5D == 'True'%0A    assert settings%5B'sendpic'%5D == 'False'%0A%0A%0Adef test_post_updates_some_fields(storage_file, client):%0A    client.post(%0A        url_for('main.settings'),%0A        data='%7B%22notify%22: true, %22sendpic%22: false%7D',%0A        headers=%7B'Content-Type': 'application/json'%7D)%0A    settings = ls.get_all('settings')%0A    assert settings%5B'serverip'%5D == '0.0.0.0'%0A    assert settings%5B'notify'%5D == 'True'%0A    assert settings%5B'sendpic'%5D == 'False'%0A%0A%0Adef test_post_ignores_unexistant_fields(storage_file, client):%0A    client.post(%0A        url_for('main.settings'),%0A        data='%7B%22fantasy%22: %22fiction%22%7D',%0A        headers=%7B'Content-Type': 'application/json'%7D)%0A    settings = ls.get_all('settings')%0A    with pytest.raises(KeyError):%0A        assert settings%5B'fantasy'%5D == 'fiction'%0A

Add tests for settings handlers