Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
9a33abf
Started implementation of POST /api/v2/alerts-filters
Elise17 Oct 8, 2025
b7088fd
Fixed analysis check
Elise17 Oct 8, 2025
103ed2c
Added function _load
Elise17 Oct 8, 2025
82bfec6
Deprecated endpoint POST /filters/add in favor of POST /api/v2/alerts…
Elise17 Oct 8, 2025
5b1290e
Added test create alert when filter data is missing
Elise17 Oct 8, 2025
ea45b99
Added test test_create_alert_filter_should_return_filter_type
Elise17 Oct 8, 2025
4c5ddd6
Added test_create_alert_filter_should_return_filter_name
Elise17 Oct 8, 2025
0a0f63d
Added test_create_alert_filter_should_return_in_filter_data_alert_title
Elise17 Oct 8, 2025
af0bf2b
Started implementation of GET /api/v2/alerts-filters/{identifier}
Elise17 Oct 17, 2025
0c911fe
Fixed check analysis
Elise17 Oct 17, 2025
8559ad7
Fixed importation problem
Elise17 Oct 17, 2025
7440b09
Fixed static analysis
Elise17 Oct 17, 2025
0690eb0
Removed user in test
Elise17 Oct 17, 2025
1129b73
Added test_get_alert_filter_should_return_filter_name
Elise17 Oct 17, 2025
97a89e5
Deprecated endpoint GET /filters/{identifier}
Elise17 Oct 17, 2025
622b46a
Added test_get_alert_filter_should_return_404
Elise17 Oct 17, 2025
9a1fffd
Added test_get_alert_filter_should_return_404_when_user_has_not_creat…
Elise17 Oct 17, 2025
e4b4998
Fixed static analysis
Elise17 Oct 17, 2025
69e38c8
Started implementation of PUT /api/v2/alerts-filters/{identifier}
Elise17 Oct 21, 2025
ec809ef
Fixed static analysis
Elise17 Oct 21, 2025
f438d3b
Added test_update_alert_filter_should_return_filter_name
Elise17 Oct 21, 2025
930e94c
Added test_update_alert_filter_should_return_filter_description
Elise17 Oct 21, 2025
120bed5
Added test_update_alert_filter_should_return_filter_type
Elise17 Oct 21, 2025
48c0957
Added test_update_alert_filter_should_return_filter_data_alert_title
Elise17 Oct 21, 2025
657d441
Added test_update_alert_filter_should_return_404_when_alert_filter_is…
Elise17 Oct 21, 2025
1008f29
Removed identifietr in test_update_alert_filter_should_return_404_whe…
Elise17 Oct 21, 2025
78234ef
Deprecated endpoint POST /filters/update/{identifier}
Elise17 Oct 21, 2025
eb541cb
Started implmentation of endpoint DELETE /api/v2/alerts-filters/{iden…
Elise17 Oct 21, 2025
745739c
Added test_delete_alert_filter_should_return_404_when_alert_not_found
Elise17 Oct 21, 2025
74bf4ea
test_get_alert_filter_should_return_404_after_delete_alert_filter
Elise17 Oct 21, 2025
157d749
Deprecated endpoint DELETE /api/v2/alerts-filters/{identifier}
Elise17 Oct 21, 2025
9a5a4c7
Fixed check analysis
Elise17 Oct 21, 2025
cb3ec88
Changed indentation and added ValidationError
Elise17 Oct 21, 2025
8d345f3
Changed indentation and added ValidationError
Elise17 Oct 21, 2025
b68b34c
Added new test test_update_alert_filter_should_return_400
Elise17 Oct 21, 2025
2dbfb95
Renamed method
c8y3 Oct 6, 2025
d1986e9
Renamed method
c8y3 Oct 6, 2025
7a8cfc5
Aligned method call
c8y3 Oct 6, 2025
ddef892
Started implementation of GET /api/v2/manage/customers/{identifier}
c8y3 Oct 6, 2025
6096f3b
Moved code down into persistence layer
c8y3 Oct 8, 2025
c7c77d0
Removed unused imports
c8y3 Oct 8, 2025
115d9ae
Added tow new import constraints: do not import marshables and do not…
c8y3 Oct 8, 2025
497135d
One import per line
c8y3 Oct 8, 2025
2651462
Removed dead code
c8y3 Oct 8, 2025
358d2d1
One import per line
c8y3 Oct 8, 2025
2c041aa
Following calling conventions
c8y3 Oct 8, 2025
3a6204b
Moved code down into the business and persistence layers
c8y3 Oct 8, 2025
acd242b
Early return
c8y3 Oct 8, 2025
cef2751
Simple quotes
c8y3 Oct 8, 2025
3fe05d1
Introduced method to get a customer by its name
c8y3 Oct 8, 2025
99842fc
Ruff warning
c8y3 Oct 8, 2025
50b4982
Added method to create a customer in the business layer
c8y3 Oct 8, 2025
3282472
Added a TODO
c8y3 Oct 8, 2025
7791840
Do not import iris_current_user from app.business.cases
c8y3 Oct 8, 2025
573a842
Removed unnecessary method parameter
c8y3 Oct 8, 2025
5411f32
Parameter need not be optional
c8y3 Oct 8, 2025
c1a2036
Extracted method
c8y3 Oct 8, 2025
410cdac
Extracted method
c8y3 Oct 8, 2025
f009aba
Removed one call to iris_current_user from iris_engine
c8y3 Oct 8, 2025
e1e3691
Moved code down into models
c8y3 Oct 8, 2025
1754dbf
Moved test .env file at the top level as .env.tests.model
c8y3 Oct 22, 2025
7ceee59
Renamed method to follow conventions
c8y3 Oct 24, 2025
e73af4d
GET /api/v2/customers/{identifier} should return 404 when it doesn't …
c8y3 Oct 24, 2025
30f49e2
Renamed test
c8y3 Oct 24, 2025
31e8495
Deprecate GET /manage/customers/{client_id}
c8y3 Oct 24, 2025
f3163c8
GET /api/v2/manage/customers/{identifier} returns 403 when user has n…
c8y3 Oct 24, 2025
df5de76
Removed methods which seem to be dead
c8y3 Oct 24, 2025
d912cac
Added rule RUF100
c8y3 Oct 24, 2025
74b9866
Added ruff rule RUF029
c8y3 Oct 24, 2025
e0ba692
Added ruff rules FURB14*
c8y3 Oct 24, 2025
405e758
Added ruff rule ARG003 and ARG005
c8y3 Oct 24, 2025
0d4f59f
Added ruff rules PYI*
c8y3 Oct 24, 2025
86e556b
Fixed and added all ruff B00* rules
c8y3 Oct 24, 2025
0329817
Set ruff rules FURB142, FURB145 and FURB148 rather than RUF14* (I am …
c8y3 Oct 24, 2025
4070b55
Removed PYI rules: we do not seem to use pyi
c8y3 Oct 24, 2025
535556f
Added dead code check with vulture
c8y3 Oct 24, 2025
9cc46da
Renamed vulture ignore file so that ruff does not parse it as a pytho…
c8y3 Oct 24, 2025
3fb283a
Removed validate_asset_type from vulture ignore list to check it fail…
c8y3 Oct 24, 2025
13bb46c
Removed seemingly dead methods
c8y3 Oct 24, 2025
e89de9e
Commented seemingly dead code which is used by iris-module-interface
c8y3 Oct 24, 2025
e080126
Started implementation of PUT /api/v2/manage/customers/{identifier}
c8y3 Oct 29, 2025
b400f72
PUT /api/v2/manage/customers/{identifier} should return 400 when anot…
c8y3 Oct 29, 2025
e6625f1
Moved database code out of marshables into the persistence layer
c8y3 Oct 29, 2025
39ac885
Added some ignored files to vulture
c8y3 Oct 29, 2025
33a4a4e
Improved configuration of vulture somewhat
c8y3 Oct 29, 2025
de86e58
Improved configuration of vulture somewhat
c8y3 Oct 29, 2025
f25c442
Improved configuration of vulture somewhat
c8y3 Oct 29, 2025
de3b44e
Organized vulture ignore file a bit more
c8y3 Oct 29, 2025
c4a4881
Simplified vulture ignore file somewhat
c8y3 Oct 29, 2025
97ee448
Deprecated PUT /manage/customers/update/<int:client_id>
c8y3 Oct 29, 2025
48c1209
Removed one occurence of ElementNotFoundException (use ObjectNotFound…
c8y3 Oct 29, 2025
ee14b4a
Removed unnecessary parameter
c8y3 Oct 29, 2025
ed60317
Removed exception ElementNotFoundException
c8y3 Oct 29, 2025
c5c4dd1
Fixed some deepsource warnings
c8y3 Oct 29, 2025
2105ca1
Added E20* ruff rules, and fixed warnings
c8y3 Oct 29, 2025
e25ba98
Added ruff rule W391
c8y3 Oct 29, 2025
20b074c
Fixed ruff warnings
c8y3 Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added test_get_alert_filter_should_return_404
  • Loading branch information
Elise17 committed Oct 17, 2025
commit 622b46a34f7122a6205074378e3f87c115e94e52
11 changes: 5 additions & 6 deletions source/app/blueprints/rest/v2/alerts_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

from app.schema.marshables import SavedFilterSchema
from app.business.errors import ObjectNotFoundError
from app.business.alerts_filters import alerts_filters_add
from app.business.alerts_filters import alerts_filters_get
from app.business.alerts_filters import alert_filter_add
from app.business.alerts_filters import alert_filter_get


class AlertsFiltersOperations:
Expand All @@ -48,17 +48,16 @@

try:
new_saved_filter = self._load(request_data)
alerts_filters_add(new_saved_filter)
alert_filter_add(new_saved_filter)
return response_api_created(self._schema.dump(new_saved_filter))

except ValidationError as e:
return response_api_error('Data error', e.messages)

Check failure on line 56 in source/app/blueprints/rest/v2/alerts_filters.py

View workflow job for this annotation

GitHub Actions / Static analyis checks

Ruff (W293)

source/app/blueprints/rest/v2/alerts_filters.py:56:1: W293 Blank line contains whitespace
def get(self, identifier):
try:
saved_filter = alerts_filters_get(identifier)
saved_filter = alert_filter_get(identifier)
return response_api_success(self._schema.dump(saved_filter))

except ObjectNotFoundError:
return response_api_not_found()

Expand Down
11 changes: 7 additions & 4 deletions source/app/business/alerts_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

from app import db
from app.datamgmt.filters.filters_db import get_filter_by_id
from app.business.errors import ObjectNotFoundError


def alerts_filters_add(new_saved_filter):
def alert_filter_add(new_saved_filter):

Check failure on line 23 in source/app/business/alerts_filters.py

View workflow job for this annotation

GitHub Actions / Static analyis checks

Ruff (E302)

source/app/business/alerts_filters.py:23:1: E302 Expected 2 blank lines, found 1
db.session.add(new_saved_filter)
db.session.commit()


def alerts_filters_get(identifier):
return get_filter_by_id(identifier)
def alert_filter_get(identifier):
alert_filter = get_filter_by_id(identifier)
if not alert_filter:
raise ObjectNotFoundError()
return alert_filter
6 changes: 6 additions & 0 deletions tests/tests_rest_alerts_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from unittest import TestCase
from iris import Iris

_IDENTIFIER_FOR_NONEXISTENT_OBJECT = 123456789


class TestsRestAlertsFilters(TestCase):

Expand Down Expand Up @@ -221,3 +223,7 @@
identifier = response['filter_id']
response = self._subject.get(f'/api/v2/alerts-filters/{identifier}').json()
self.assertEqual(filter_name, response['filter_name'])

Check failure on line 226 in tests/tests_rest_alerts_filters.py

View workflow job for this annotation

GitHub Actions / Static analyis checks

Ruff (W293)

tests/tests_rest_alerts_filters.py:226:1: W293 Blank line contains whitespace
def test_get_alert_filter_should_return_404_when_alert_filter_not_found(self):
response = self._subject.get(f'/api/v2/alerts-filters/{_IDENTIFIER_FOR_NONEXISTENT_OBJECT}')
self.assertEqual(404, response.status_code)
Loading