mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
fix plus enabled for addons
This commit is contained in:
parent
3c46a33992
commit
37325c70ba
@ -25,7 +25,7 @@ from flask import (
|
|||||||
from peewee import SqliteDatabase, operator, fn, DoesNotExist
|
from peewee import SqliteDatabase, operator, fn, DoesNotExist
|
||||||
from playhouse.shortcuts import model_to_dict
|
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.models import Event, Recordings
|
||||||
from frigate.stats import stats_snapshot
|
from frigate.stats import stats_snapshot
|
||||||
from frigate.version import VERSION
|
from frigate.version import VERSION
|
||||||
@ -571,7 +571,7 @@ def config():
|
|||||||
for cmd in camera_dict["ffmpeg_cmds"]:
|
for cmd in camera_dict["ffmpeg_cmds"]:
|
||||||
cmd["cmd"] = " ".join(cmd["cmd"])
|
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)
|
return jsonify(config)
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ from playhouse.shortcuts import model_to_dict
|
|||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.http import create_app
|
from frigate.http import create_app
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings
|
||||||
|
from frigate.plus import PlusApi
|
||||||
|
|
||||||
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
|
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_get_event_list(self):
|
def test_get_event_list(self):
|
||||||
app = create_app(
|
app = create_app(
|
||||||
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
id2 = "7890.random"
|
id2 = "7890.random"
|
||||||
@ -142,7 +143,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_get_good_event(self):
|
def test_get_good_event(self):
|
||||||
app = create_app(
|
app = create_app(
|
||||||
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_get_bad_event(self):
|
def test_get_bad_event(self):
|
||||||
app = create_app(
|
app = create_app(
|
||||||
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
bad_id = "654321.other"
|
bad_id = "654321.other"
|
||||||
@ -169,7 +170,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_delete_event(self):
|
def test_delete_event(self):
|
||||||
app = create_app(
|
app = create_app(
|
||||||
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
|
|
||||||
@ -184,7 +185,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_event_retention(self):
|
def test_event_retention(self):
|
||||||
app = create_app(
|
app = create_app(
|
||||||
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
|
|
||||||
@ -203,7 +204,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_set_delete_sub_label(self):
|
def test_set_delete_sub_label(self):
|
||||||
app = create_app(
|
app = create_app(
|
||||||
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
sub_label = "sub"
|
sub_label = "sub"
|
||||||
@ -231,7 +232,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
|
|
||||||
def test_sub_label_list(self):
|
def test_sub_label_list(self):
|
||||||
app = create_app(
|
app = create_app(
|
||||||
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
FrigateConfig(**self.minimal_config), self.db, None, None, PlusApi()
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
sub_label = "sub"
|
sub_label = "sub"
|
||||||
@ -253,7 +254,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
self.db,
|
self.db,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
PlusApi(),
|
||||||
)
|
)
|
||||||
|
|
||||||
with app.test_client() as client:
|
with app.test_client() as client:
|
||||||
@ -267,7 +268,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
self.db,
|
self.db,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
PlusApi(),
|
||||||
)
|
)
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
|
|
||||||
@ -284,7 +285,7 @@ class TestHttp(unittest.TestCase):
|
|||||||
self.db,
|
self.db,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
PlusApi(),
|
||||||
)
|
)
|
||||||
mock_stats.return_value = self.test_stats
|
mock_stats.return_value = self.test_stats
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user