Fix error on save special permission (#1145)

This commit is contained in:
Pascal Vizeli 2019-07-04 17:30:42 +02:00 committed by GitHub
parent 157740e374
commit 0a34f427f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -291,7 +291,7 @@ class APIAddons(CoreSysAttributes):
_LOGGER.warning("Protected flag changing for %s!", addon.slug)
addon.protected = body[ATTR_PROTECTED]
addon.save_data()
addon.save_persist()
@api_process
async def stats(self, request: web.Request) -> Dict[str, Any]:

View File

@ -96,8 +96,6 @@ class Ingress(JsonConfig, CoreSysAttributes):
valid = utcnow() + timedelta(minutes=15)
self.sessions[session] = valid.timestamp()
self.save_data()
return session
def validate_session(self, session: str) -> bool:

View File

@ -9,7 +9,6 @@ def test_session_handling(coresys):
session = coresys.ingress.create_session()
validate = coresys.ingress.sessions[session]
assert coresys.ingress.save_data.called
assert session
assert validate
@ -22,6 +21,14 @@ def test_session_handling(coresys):
assert not coresys.ingress.validate_session("invalid session")
async def test_save_on_unload(coresys):
"""Test called save on unload."""
coresys.ingress.create_session()
await coresys.ingress.unload()
assert coresys.ingress.save_data.called
def test_dynamic_ports(coresys):
"""Test dyanmic port handling."""
port_test1 = coresys.ingress.get_dynamic_port("test1")