Move ops functions into state
This commit is contained in:
parent
65db66bff4
commit
c9446605bc
3 changed files with 34 additions and 38 deletions
|
@ -4,7 +4,6 @@
|
|||
import matchy.files.state as state
|
||||
import tempfile
|
||||
import os
|
||||
import matchy.files.ops as ops
|
||||
|
||||
|
||||
def test_basic_state():
|
||||
|
@ -19,11 +18,11 @@ def test_simple_load_reload():
|
|||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path = os.path.join(tmp, 'tmp.json')
|
||||
st = state.load_from_file(path)
|
||||
ops.save(st._file, st._dict)
|
||||
ops.save(st._file, st._dict)
|
||||
state._save(st._file, st._dict)
|
||||
state._save(st._file, st._dict)
|
||||
|
||||
st = state.load_from_file(path)
|
||||
ops.save(st._file, st._dict)
|
||||
state._save(st._file, st._dict)
|
||||
st = state.load_from_file(path)
|
||||
|
||||
|
||||
|
@ -32,13 +31,13 @@ def test_authscope():
|
|||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path = os.path.join(tmp, 'tmp.json')
|
||||
st = state.load_from_file(path)
|
||||
ops.save(st._file, st._dict)
|
||||
state._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)
|
||||
ops.save(st._file, st._dict)
|
||||
state._save(st._file, st._dict)
|
||||
|
||||
st = state.load_from_file(path)
|
||||
assert st.get_user_has_scope(1, state.AuthScope.MATCHER)
|
||||
|
@ -52,13 +51,13 @@ def test_channeljoin():
|
|||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path = os.path.join(tmp, 'tmp.json')
|
||||
st = state.load_from_file(path)
|
||||
ops.save(st._file, st._dict)
|
||||
state._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)
|
||||
ops.save(st._file, st._dict)
|
||||
state._save(st._file, st._dict)
|
||||
|
||||
st = state.load_from_file(path)
|
||||
assert st.get_user_active_in_channel(1, "2")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue