Skip to content

Commit

Permalink
fix plus enabled for addons
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Jul 22, 2022
1 parent 3c46a33 commit 37325c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions frigate/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
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
Expand Down Expand Up @@ -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)

Expand Down
21 changes: 11 additions & 10 deletions frigate/test/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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

Expand Down Expand Up @@ -113,7 +114,7 @@ def tearDown(self):

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"
Expand Down Expand Up @@ -142,7 +143,7 @@ def test_get_event_list(self):

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"

Expand All @@ -156,7 +157,7 @@ def test_get_good_event(self):

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"
Expand All @@ -169,7 +170,7 @@ def test_get_bad_event(self):

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"

Expand All @@ -184,7 +185,7 @@ def test_delete_event(self):

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"

Expand All @@ -203,7 +204,7 @@ def test_event_retention(self):

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"
Expand Down Expand Up @@ -231,7 +232,7 @@ def test_set_delete_sub_label(self):

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"
Expand All @@ -253,7 +254,7 @@ def test_config(self):
self.db,
None,
None,
None,
PlusApi(),
)

with app.test_client() as client:
Expand All @@ -267,7 +268,7 @@ def test_recordings(self):
self.db,
None,
None,
None,
PlusApi(),
)
id = "123456.random"

Expand All @@ -284,7 +285,7 @@ def test_stats(self, mock_stats):
self.db,
None,
None,
None,
PlusApi(),
)
mock_stats.return_value = self.test_stats

Expand Down

0 comments on commit 37325c7

Please sign in to comment.