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

Wrong member variable #357

Merged
merged 2 commits into from
Jul 6, 2021
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
2 changes: 1 addition & 1 deletion microsetta_private_api/admin/admin_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def send_email(body, token_info):
endpoint = SERVER_CONFIG["endpoint"]

if account_id is not None:
language = diag['account'].preferred_language
language = diag['account'].language

if sample_id is not None and \
source_id is not None and \
Expand Down
21 changes: 21 additions & 0 deletions microsetta_private_api/admin/tests/test_admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,3 +1060,24 @@ def test_query_barcode_stats_project_barcodes_with_strip(self):
exp_status)
n_src = sum([v['source-email'] is not None for v in response_obj])
self.assertEqual(n_src, 1)

def test_send_email(self):
def mock_func(*args, **kwargs):
pass

info = {
"issue_type": 'sample',
"template_args": {"sample_barcode": '000004220'},
'template': 'sample_is_valid'
}

with patch("microsetta_private_api.admin.admin_impl."
"celery_send_email") as mock_celery_send_email:
mock_celery_send_email.apply_async = mock_func

response = self.client.post(
"api/admin/email",
content_type="application/json",
data=json.dumps(info),
headers=MOCK_HEADERS)
self.assertEqual(204, response.status_code)