Skip to content

Commit 0f6f8b5

Browse files
committed
chore: lint fixes
1 parent c9b79d7 commit 0f6f8b5

4 files changed

Lines changed: 16 additions & 22 deletions

File tree

backend/application/core/services/observation.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ def normalize_observation_fields(observation: Observation) -> None:
168168
_normalize_origin_cloud(observation)
169169
_normalize_origin_kubernetes(observation)
170170

171-
normalize_severity(observation)
172-
normalize_status(observation)
173-
normalize_vex_justification(observation)
171+
_normalize_severity(observation)
172+
_normalize_status(observation)
173+
_normalize_vex_justification(observation)
174174
normalize_vex_remediations(observation)
175175

176176
_normalize_description(observation)
@@ -491,6 +491,8 @@ def normalize_vex_remediations(observation: Observation) -> None:
491491
observation.vex_vex_remediations = ""
492492

493493
observation.current_vex_remediations = get_current_vex_remediations(observation)
494+
495+
494496
def _normalize_update_impact_score_and_fix_available(observation: Observation) -> None:
495497
observation.fix_available = None
496498
observation.update_impact_score = None

backend/unittests/access_control/services/test_oidc_authentication.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_validate_jwt_message(self, get_signing_key_mock, pyjwkclient_mock, jwks
142142
@patch("application.access_control.services.oidc_authentication.OIDCAuthentication._get_jwks_uri")
143143
@patch("jwt.PyJWKClient.__init__")
144144
@patch("jwt.PyJWKClient.get_signing_key_from_jwt")
145-
@patch("application.access_control.services.oidc_authentication.get_user_by_username")
145+
@patch("application.access_control.services.oidc_authentication.get_user_by_email")
146146
@patch("application.access_control.services.oidc_authentication.OIDCAuthentication._create_user")
147147
def test_validate_jwt_user_not_found(
148148
self,
@@ -157,9 +157,9 @@ def test_validate_jwt_user_not_found(
157157
pyjwkclient_mock.return_value = None
158158
mock_py_jwk = MockPyJWK("test_key")
159159
get_signing_key_mock.return_value = mock_py_jwk
160-
jwt_mock.return_value = {"preferred_username": "test_username"}
160+
jwt_mock.return_value = {"email": "test@example.com"}
161161
get_user_mock.return_value = None
162-
expected_user = User(username="test_username")
162+
expected_user = User(email="test@example.com")
163163
create_user_mock.return_value = expected_user
164164

165165
settings = Settings.load()
@@ -169,7 +169,7 @@ def test_validate_jwt_user_not_found(
169169
user = oidc_authentication._validate_jwt("token")
170170

171171
self.assertEqual(user, expected_user)
172-
get_user_mock.assert_called_with("test_username")
172+
get_user_mock.assert_called_with("test@example.com")
173173
jwks_uri_mock.assert_called_once()
174174
pyjwkclient_mock.assert_called_once_with("test_jwks_uri")
175175
get_signing_key_mock.assert_called_once_with("token")
@@ -189,13 +189,13 @@ def test_validate_jwt_user_not_found(
189189
audience="client_id",
190190
leeway=7,
191191
)
192-
create_user_mock.assert_called_once_with("test_username", {"preferred_username": "test_username"})
192+
create_user_mock.assert_called_once_with("test@example.com", {"email": "test@example.com"})
193193

194194
@patch("jwt.decode")
195195
@patch("application.access_control.services.oidc_authentication.OIDCAuthentication._get_jwks_uri")
196196
@patch("jwt.PyJWKClient.__init__")
197197
@patch("jwt.PyJWKClient.get_signing_key_from_jwt")
198-
@patch("application.access_control.services.oidc_authentication.get_user_by_username")
198+
@patch("application.access_control.services.oidc_authentication.get_user_by_email")
199199
@patch("application.access_control.services.oidc_authentication.OIDCAuthentication._check_user_change")
200200
def test_validate_jwt_user_found(
201201
self,
@@ -210,7 +210,7 @@ def test_validate_jwt_user_found(
210210
pyjwkclient_mock.return_value = None
211211
mock_py_jwk = MockPyJWK("test_key")
212212
get_signing_key_mock.return_value = mock_py_jwk
213-
jwt_mock.return_value = {"preferred_username": self.user_internal.username}
213+
jwt_mock.return_value = {"email": self.user_internal.email}
214214
get_user_mock.return_value = self.user_internal
215215
check_user_change_mock.return_value = self.user_internal
216216

@@ -221,7 +221,7 @@ def test_validate_jwt_user_found(
221221
user = oidc_authentication._validate_jwt("token")
222222

223223
self.assertEqual(self.user_internal, user)
224-
get_user_mock.assert_called_with(self.user_internal.username)
224+
get_user_mock.assert_called_with(self.user_internal.email)
225225
jwks_uri_mock.assert_called_once()
226226
pyjwkclient_mock.assert_called_once_with("test_jwks_uri")
227227
get_signing_key_mock.assert_called_once_with("token")
@@ -242,7 +242,7 @@ def test_validate_jwt_user_found(
242242
leeway=5,
243243
)
244244
check_user_change_mock.assert_called_once_with(
245-
self.user_internal, {"preferred_username": self.user_internal.username}
245+
self.user_internal, {"email": self.user_internal.email}
246246
)
247247

248248
@patch("requests.request")

frontend/src/core/observation_logs/ObservationLogApprovalList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
import { PERMISSION_OBSERVATION_LOG_APPROVAL } from "../../access_control/types";
1919
import { CustomPagination } from "../../commons/custom_fields/CustomPagination";
2020
import { SeverityField } from "../../commons/custom_fields/SeverityField";
21-
import { feature_vex_enabled, has_attribute } from "../../commons/functions";
21+
import { feature_vex_enabled } from "../../commons/functions";
2222
import { AutocompleteInputMedium, AutocompleteInputWide } from "../../commons/layout/themes";
2323
import { getSettingListSize } from "../../commons/user_settings/functions";
2424
import { ASSESSMENT_STATUS_NEEDS_APPROVAL, OBSERVATION_SEVERITY_CHOICES, OBSERVATION_STATUS_CHOICES } from "../types";
@@ -180,7 +180,7 @@ const ObservationLogApprovalList = ({ product }: ObservationLogApprovalListProps
180180
<div style={{ width: "100%" }}>
181181
<FilterForm filters={listFilters(product)} />
182182
<WithListContext
183-
render={({ data }) => (
183+
render={() => (
184184
<Datagrid
185185
size={getSettingListSize()}
186186
sx={{ width: "100%" }}

frontend/src/core/observations/ObservationReviewList.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Stack } from "@mui/material";
21
import { Fragment } from "react";
32
import {
43
AutocompleteInput,
@@ -12,10 +11,8 @@ import {
1211
NumberField,
1312
ReferenceInput,
1413
ResourceContextProvider,
15-
SelectColumnsButton,
1614
TextField,
1715
TextInput,
18-
TopToolbar,
1916
WithListContext,
2017
useListController,
2118
} from "react-admin";
@@ -163,11 +160,6 @@ const BulkActionButtons = ({ product, storeKey }: BulkActionButtonsProps) => (
163160
</Fragment>
164161
);
165162

166-
const ListActions = () => (
167-
<TopToolbar>
168-
<SelectColumnsButton preferenceKey="observations.review" />
169-
</TopToolbar>
170-
);
171163
type ObservationsReviewListProps = {
172164
product?: any;
173165
};

0 commit comments

Comments
 (0)