Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/deseng 444: Engagement Metadata API #2362

Merged
merged 19 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
Merge branch 'main' into feature/deseng-444-engagement-metadata-api
NatSquared authored Jan 25, 2024
commit 2780b935cd5d3309cffa04e13fcde82d37b7c549
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## January 22, 2024

- **Task** Add missing unit tests for met api [🎟️DESENG-481](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-481)
- Added missing unit tests for met api
- Added unit tests for error handling for met api

## January 19, 2024

- **Feature**: Add metadata management to the API [🎟️DESENG-442](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-442)
58 changes: 29 additions & 29 deletions met-api/tests/utilities/factory_scenarios.py
Original file line number Diff line number Diff line change
@@ -396,35 +396,35 @@ class TestJwtClaims(dict, Enum):
'tenant_id': 1,
'email': 'staff@gov.bc.ca',
'identity_provider': LoginSource.IDIR.value,
'realm_access': {
'roles': [
'staff',
'view_engagement',
'create_engagement',
'edit_engagement',
'create_survey',
'view_users',
'view_private_engagements',
'create_admin_user',
'view_all_surveys',
'view_surveys',
'edit_all_surveys',
'edit_survey',
'view_unapproved_comments',
'clone_survey',
'edit_members',
'review_comments',
'review_all_comments',
'view_all_engagements',
'toggle_user_status',
'export_all_to_csv',
'update_user_group',
'export_proponent_comment_sheet',
'export_internal_comment_sheet',
'create_tenant',
'view_tenant',
]
}
'client_roles': [
'staff',
'view_engagement',
'create_engagement',
'edit_engagement',
'create_survey',
'view_users',
'view_private_engagements',
'create_admin_user',
'view_all_surveys',
'view_surveys',
'edit_all_surveys',
'edit_survey',
'view_unapproved_comments',
'clone_survey',
'edit_members',
'review_comments',
'review_all_comments',
'view_all_engagements',
'toggle_user_status',
'export_all_to_csv',
'update_user_group',
'export_proponent_comment_sheet',
'export_internal_comment_sheet',
'export_cac_form_to_sheet',
'view_members',
'create_tenant',
'view_tenant',
]
}
team_member_role = {
'iss': CONFIG.JWT_OIDC_TEST_ISSUER,
7 changes: 4 additions & 3 deletions met-api/tests/utilities/factory_utils.py
Original file line number Diff line number Diff line change
@@ -48,9 +48,10 @@
from met_api.utils.constants import TENANT_ID_HEADER
from met_api.utils.enums import MembershipStatus
from tests.utilities.factory_scenarios import (
TestCommentInfo, TestEngagementInfo, TestEngagementMetadataInfo, TestEngagementSlugInfo, TestFeedbackInfo, TestJwtClaims, TestParticipantInfo,
TestReportSettingInfo, TestSubmissionInfo, TestSurveyInfo, TestTenantInfo, TestUserInfo, TestWidgetDocumentInfo,
TestWidgetInfo, TestWidgetItemInfo, TestEngagementMetadataTaxonInfo)
TestCommentInfo, TestEngagementInfo, TestEngagementSlugInfo, TestFeedbackInfo, TestParticipantInfo,
TestReportSettingInfo, TestSubmissionInfo, TestSurveyInfo, TestTenantInfo, TestTimelineInfo, TestUserInfo,
TestWidgetDocumentInfo, TestWidgetInfo, TestWidgetItemInfo, TestWidgetMap, TestWidgetVideo,
TestEngagementMetadataTaxonInfo, TestEngagementMetadataInfo, TestJwtClaims)

CONFIG = get_named_config('testing')
fake = Faker()

Unchanged files with check annotations Beta

import React, { createContext, useState, useEffect } from 'react';
import { postEngagement, getEngagement, patchEngagement } from '../../../services/engagementService';
import {
postEngagementMetadata,

Check warning on line 4 in met-web/src/components/engagement/form/ActionContext.tsx

GitHub Actions / linting (16.x)

'postEngagementMetadata' is defined but never used
getEngagementMetadata,
patchEngagementMetadata,

Check warning on line 6 in met-web/src/components/engagement/form/ActionContext.tsx

GitHub Actions / linting (16.x)

'patchEngagementMetadata' is defined but never used
} from '../../../services/engagementMetadataService';
import { useNavigate, useParams } from 'react-router-dom';
import { EngagementContext, EngagementForm, EngagementFormUpdate, EngagementParams } from './types';
import { openNotification } from 'services/notificationService/notificationSlice';
import { useAppDispatch, useAppSelector } from 'hooks';
import { getErrorMessage } from 'utils';
import { updatedDiff, diff } from 'deep-object-diff';

Check warning on line 20 in met-web/src/components/engagement/form/ActionContext.tsx

GitHub Actions / linting (16.x)

'diff' is defined but never used
import { PatchEngagementRequest } from 'services/engagementService/types';
import { USER_ROLES } from 'services/userService/constants';
import { EngagementStatus } from 'constants/engagementStatus';
import { Grid } from '@mui/material';
export default class EngagementBannerWC extends HTMLElement {
root: any;

Check warning on line 14 in met-web/src/web-components/components/engagement-banner-wc.tsx

GitHub Actions / linting (16.x)

Unexpected any. Specify a different type
observer: MutationObserver;
shadowContainer: any;

Check warning on line 16 in met-web/src/web-components/components/engagement-banner-wc.tsx

GitHub Actions / linting (16.x)

Unexpected any. Specify a different type
constructor(componentToMount: React.ComponentType) {
super();
this.observer = new MutationObserver(() => this.update());
});
const shadowTheme = createWcTheme(shadowRootElement);
this.root = ReactDOM.createRoot(shadowRootElement);
const props: any = {

Check warning on line 46 in met-web/src/web-components/components/engagement-banner-wc.tsx

GitHub Actions / linting (16.x)

Unexpected any. Specify a different type
...this.getProps(this.attributes),
...this.getEvents(),
};
this.unmount();
this.mount();
}
getProps(attributes: any) {

Check warning on line 87 in met-web/src/web-components/components/engagement-banner-wc.tsx

GitHub Actions / linting (16.x)

Unexpected any. Specify a different type
return [...attributes]
.filter((attr) => attr.name !== 'style')
.map((attr) => this.convert(attr.name, attr.value))
.reduce(
(events, ev) => ({
...events,
[ev.name]: (args: any) => this.dispatchEvent(new CustomEvent(ev.name, { ...args })),

Check warning on line 99 in met-web/src/web-components/components/engagement-banner-wc.tsx

GitHub Actions / linting (16.x)

Unexpected any. Specify a different type
}),
{},
);
}
convert(attrName: any, attrValue: any) {

Check warning on line 104 in met-web/src/web-components/components/engagement-banner-wc.tsx

GitHub Actions / linting (16.x)

Unexpected any. Specify a different type

Check warning on line 104 in met-web/src/web-components/components/engagement-banner-wc.tsx

GitHub Actions / linting (16.x)

Unexpected any. Specify a different type
let value = attrValue;
if (attrValue === 'true' || attrValue === 'false') value = attrValue === 'true';
else if (!isNaN(attrValue) && attrValue !== '') value = +attrValue;
You are viewing a condensed version of this merge commit. You can view the full changes here.