mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-25 21:41:27 +00:00
test(services): test possibly undefined json fields. On writing
This commit is contained in:
parent
bf0b774295
commit
bcf57ea738
|
@ -544,7 +544,23 @@ def test_enabling_disabling_reads_json(dummy_service: DummyService):
|
||||||
assert dummy_service.is_enabled() is True
|
assert dummy_service.is_enabled() is True
|
||||||
|
|
||||||
|
|
||||||
def test_enabling_disabling_writes_json(dummy_service: DummyService):
|
@pytest.fixture(params=["normally_enabled", "deleted_attribute", "service_not_in_json"])
|
||||||
|
def possibly_dubiously_enabled_service(
|
||||||
|
dummy_service: DummyService, request
|
||||||
|
) -> DummyService:
|
||||||
|
if request.param == "deleted_attribute":
|
||||||
|
with WriteUserData() as data:
|
||||||
|
del data[dummy_service.get_id()]["enable"]
|
||||||
|
if request.param == "service_not_in_json":
|
||||||
|
with WriteUserData() as data:
|
||||||
|
del data[dummy_service.get_id()]
|
||||||
|
return dummy_service
|
||||||
|
|
||||||
|
|
||||||
|
def test_enabling_disabling_writes_json(
|
||||||
|
possibly_dubiously_enabled_service: DummyService,
|
||||||
|
):
|
||||||
|
dummy_service = possibly_dubiously_enabled_service
|
||||||
|
|
||||||
dummy_service.disable()
|
dummy_service.disable()
|
||||||
with ReadUserData() as data:
|
with ReadUserData() as data:
|
||||||
|
|
Loading…
Reference in a new issue