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

fix linting #63

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions met-api/src/met_api/services/email_verification_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ def create(cls, email_verification: EmailVerificationSchema,
email_verification['created_by'] = email_verification.get(
'participant_id')
verification_token = uuid.uuid4()
EmailVerification.create({ **email_verification, 'verification_token': verification_token}, session)
EmailVerification.create({**email_verification, 'verification_token': verification_token}, session)

# TODO: remove this once email logic is brought over from submission service to here
if email_verification.get('type', None) != EmailVerificationType.RejectedComment:
cls._send_verification_email({ **email_verification, 'verification_token': verification_token}, subscription_type)
cls._send_verification_email(
{**email_verification, 'verification_token': verification_token}, subscription_type)

return email_verification

Expand Down Expand Up @@ -245,7 +246,8 @@ def _get_project_name(subscription_type, tenant_name, engagement):

if subscription_type == SubscriptionTypes.PROJECT.value:
metadata_model: EngagementMetadataModel = EngagementMetadataModel.find_by_id(engagement.id)
project_name = metadata_model.project_metadata.get('project_name', None) if metadata_model else engagement.name
project_name = (
metadata_model.project_metadata.get('project_name', None) if metadata_model else engagement.name)
return project_name

if subscription_type == SubscriptionTypes.ENGAGEMENT.value:
Expand Down
5 changes: 3 additions & 2 deletions met-api/tests/unit/api/test_email_verification_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from met_api.services.email_verification_service import EmailVerificationService
from met_api.utils.enums import ContentType
from tests.utilities.factory_scenarios import TestJwtClaims
from tests.utilities.factory_utils import factory_auth_header, factory_email_verification, factory_survey_and_eng_model, set_global_tenant
from tests.utilities.factory_utils import (
factory_auth_header, factory_email_verification, factory_survey_and_eng_model, set_global_tenant)

fake = Faker()

Expand Down Expand Up @@ -130,4 +131,4 @@ def test_post_subscription_email_verification(client, jwt, session, notify_mock,
rv = client.post(f'/api/email_verification/{SubscriptionTypes.PROJECT.value}/subscribe',
data=json.dumps(to_dict),
headers=headers, content_type=ContentType.JSON.value)
assert rv.status_code == expected_status
assert rv.status_code == expected_status
2 changes: 1 addition & 1 deletion met-api/tests/utilities/factory_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def factory_email_verification(survey_id, verification_type=None, submission_id=
is_active=True
)
email_verification.type = verification_type if verification_type else EmailVerificationType.Survey

if survey_id:
email_verification.survey_id = survey_id

Expand Down
Loading