fix plus enabled for addons

This commit is contained in:
Blake Blackshear 2022-07-22 07:56:28 -05:00
parent 3c46a33992
commit 37325c70ba
2 changed files with 13 additions and 12 deletions

View File

@ -25,7 +25,7 @@ from flask import (
from peewee import SqliteDatabase, operator, fn, DoesNotExist
from playhouse.shortcuts import model_to_dict
from frigate.const import CLIPS_DIR, PLUS_ENV_VAR
from frigate.const import CLIPS_DIR
from frigate.models import Event, Recordings
from frigate.stats import stats_snapshot
from frigate.version import VERSION
@ -571,7 +571,7 @@ def config():
for cmd in camera_dict["ffmpeg_cmds"]:
cmd["cmd"] = " ".join(cmd["cmd"])
config["plus"] = {"enabled": PLUS_ENV_VAR in os.environ}
config["plus"] = {"enabled": current_app.plus_api.is_active()}
return jsonify(config)

View File

@ -13,6 +13,7 @@ from playhouse.shortcuts import model_to_dict
from frigate.config import FrigateConfig
from frigate.http import create_app
from frigate.models import Event, Recordings
from frigate.plus import PlusApi
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
@ -113,7 +114,7 @@ class TestHttp(unittest.TestCase):
def test_get_event_list(self):
app = create_app(
FrigateConfig(**self.minimal_config), self.db, None, None, None
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
)
id = "123456.random"
id2 = "7890.random"
@ -142,7 +143,7 @@ class TestHttp(unittest.TestCase):
def test_get_good_event(self):
app = create_app(
FrigateConfig(**self.minimal_config), self.db, None, None, None
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
)
id = "123456.random"
@ -156,7 +157,7 @@ class TestHttp(unittest.TestCase):
def test_get_bad_event(self):
app = create_app(
FrigateConfig(**self.minimal_config), self.db, None, None, None
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
)
id = "123456.random"
bad_id = "654321.other"
@ -169,7 +170,7 @@ class TestHttp(unittest.TestCase):
def test_delete_event(self):
app = create_app(
FrigateConfig(**self.minimal_config), self.db, None, None, None
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
)
id = "123456.random"
@ -184,7 +185,7 @@ class TestHttp(unittest.TestCase):
def test_event_retention(self):
app = create_app(
FrigateConfig(**self.minimal_config), self.db, None, None, None
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
)
id = "123456.random"
@ -203,7 +204,7 @@ class TestHttp(unittest.TestCase):
def test_set_delete_sub_label(self):
app = create_app(
FrigateConfig(**self.minimal_config), self.db, None, None, None
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
)
id = "123456.random"
sub_label = "sub"
@ -231,7 +232,7 @@ class TestHttp(unittest.TestCase):
def test_sub_label_list(self):
app = create_app(
FrigateConfig(**self.minimal_config), self.db, None, None, None
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
)
id = "123456.random"
sub_label = "sub"
@ -253,7 +254,7 @@ class TestHttp(unittest.TestCase):
self.db,
None,
None,
None,
PlusApi(),
)
with app.test_client() as client:
@ -267,7 +268,7 @@ class TestHttp(unittest.TestCase):
self.db,
None,
None,
None,
PlusApi(),
)
id = "123456.random"
@ -284,7 +285,7 @@ class TestHttp(unittest.TestCase):
self.db,
None,
None,
None,
PlusApi(),
)
mock_stats.return_value = self.test_stats