-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
99 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
webapp/home/templates/home/requests/access/snippets/personal-details-fields.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<div class="row mb-10"> | ||
<div class="col-sm-12"> | ||
<label for="nameInput" class="form-label">Name</label> | ||
{{ form.name.errors }} | ||
<input class="form-control" id="nameInput" type="text" name="name" | ||
value="{{form.name.value|default_if_none:''}}" required | ||
> | ||
</div> | ||
|
||
<div class="col-sm-12"> | ||
<label for="emailInput" class="form-label">Galaxy account email</label> | ||
{{ form.email.errors }} | ||
<input class="form-control" id="emailInput" type="email" name="email" | ||
value="{{form.email.value|default_if_none:''}}" | ||
aria-describedby="emailHelp" | ||
onfocus="$('#emailHelp').show();" | ||
autocomplete="off" | ||
required | ||
> | ||
<div | ||
class="form-text" | ||
id="emailHelp" | ||
style="display: none;" | ||
> | ||
<div class="alert alert-danger"> | ||
<ul style="margin: 0;"> | ||
<li> | ||
Your Galaxy Australia account must be registered to this email | ||
for us to provide access | ||
</li> | ||
<li> | ||
Go to User > Preferences > Manage information to see your registered | ||
email address on usegalaxy.org.au | ||
</li> | ||
<li> | ||
Access will be provided only to recognised | ||
<a href="/institutions"> | ||
Australian institution email addresses | ||
</a> | ||
</li> | ||
<ul> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-sm-12"> | ||
<label for="institutionInput" class="form-label">Institution</label> | ||
{{ form.institution.errors }} | ||
<input | ||
class="form-control" | ||
id="institutionInput" | ||
name="institution" | ||
type="text" | ||
value="{{form.institution.value|default_if_none:''}}" | ||
aria-describedby="institutionHelp" | ||
required | ||
/> | ||
<div class="form-text" id="institutionHelp"> | ||
Your department, organization or research institute | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,17 +181,7 @@ def test_it_can_handle_request_for_alphafold_access(self): | |
'email': '[email protected]', | ||
'institution': 'University of Queensland', | ||
}) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertContains( | ||
response, | ||
'Thanks for your submission', | ||
) | ||
self.assertContains( | ||
response, | ||
'please check your spam folder', | ||
) | ||
# Mail sent to admins and user | ||
self.assertEqual(len(mail.outbox), 2) | ||
self.assert_access_form_success(response, auto_action=True) | ||
|
||
def test_it_can_handle_request_for_fgenesh_access(self): | ||
response = self.client.post('/request/access/fgenesh', { | ||
|
@@ -202,15 +192,39 @@ def test_it_can_handle_request_for_fgenesh_access(self): | |
'agree_acknowledge': 'on', | ||
'matrices': [genematrix_tree.as_choices()[0][0]], | ||
}) | ||
self.assert_access_form_success(response, auto_action=False) | ||
|
||
def test_it_can_handle_request_for_cellranger_access(self): | ||
response = self.client.post('/request/access/cellranger', { | ||
'name': 'John Doe', | ||
'email': '[email protected]', | ||
'institution': 'University of Queensland', | ||
'agree_terms': 'on', | ||
'agree_usage': 'on', | ||
}) | ||
self.assert_access_form_success(response, auto_action=True) | ||
|
||
def assert_access_form_success(self, response, auto_action=True): | ||
"""Assert that an auto-action form has been successfully submitted. | ||
Auto-action forms send an email to user to let them know that access | ||
has been granted. Non-auto-action forms do not send an email because | ||
manual intervention is required. | ||
""" | ||
self.assertEqual(response.status_code, 200) | ||
self.assertContains( | ||
response, | ||
'Thanks for your submission', | ||
) | ||
# FGenesh needs to be actioned by admins, so user mail should not be | ||
# sent | ||
self.assertNotContains( | ||
response, | ||
'please check your spam folder', | ||
) | ||
self.assertEqual(len(mail.outbox), 1) | ||
if auto_action: | ||
self.assertContains( | ||
response, | ||
'please check your spam folder', | ||
) | ||
else: | ||
self.assertNotContains( | ||
response, | ||
'please check your spam folder', | ||
) | ||
expect_len = 2 if auto_action else 1 | ||
self.assertEqual(len(mail.outbox), expect_len) |