Remove config, YAGNI

This commit is contained in:
Marc Di Luzio 2024-08-16 23:15:43 +01:00
parent 63d9081e07
commit 5e262deda6
5 changed files with 15 additions and 165 deletions

View file

@ -4,6 +4,7 @@
import matchy.files.state as state
import tempfile
import os
import matchy.files.ops as ops
def test_basic_state():
@ -18,10 +19,11 @@ def test_simple_load_reload():
with tempfile.TemporaryDirectory() as tmp:
path = os.path.join(tmp, 'tmp.json')
st = state.load_from_file(path)
st._save_to_file()
ops.save(st._file, st._dict)
ops.save(st._file, st._dict)
st = state.load_from_file(path)
st._save_to_file()
ops.save(st._file, st._dict)
st = state.load_from_file(path)
@ -30,13 +32,13 @@ def test_authscope():
with tempfile.TemporaryDirectory() as tmp:
path = os.path.join(tmp, 'tmp.json')
st = state.load_from_file(path)
st._save_to_file()
ops.save(st._file, st._dict)
assert not st.get_user_has_scope(1, state.AuthScope.MATCHER)
st = state.load_from_file(path)
st.set_user_scope(1, state.AuthScope.MATCHER)
st._save_to_file()
ops.save(st._file, st._dict)
st = state.load_from_file(path)
assert st.get_user_has_scope(1, state.AuthScope.MATCHER)
@ -50,13 +52,13 @@ def test_channeljoin():
with tempfile.TemporaryDirectory() as tmp:
path = os.path.join(tmp, 'tmp.json')
st = state.load_from_file(path)
st._save_to_file()
ops.save(st._file, st._dict)
assert not st.get_user_active_in_channel(1, "2")
st = state.load_from_file(path)
st.set_user_active_in_channel(1, "2", True)
st._save_to_file()
ops.save(st._file, st._dict)
st = state.load_from_file(path)
assert st.get_user_active_in_channel(1, "2")