Skip to content

Commit

Permalink
fix linting (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolkamps1 authored Jun 14, 2024
1 parent f125a2b commit 212b660
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
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

0 comments on commit 212b660

Please sign in to comment.