Skip to content

Commit

Permalink
one more full month required
Browse files Browse the repository at this point in the history
  • Loading branch information
elichad committed Aug 2, 2023
1 parent c3233f0 commit bc5a975
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
28 changes: 27 additions & 1 deletion amy/dashboard/tests/test_instructor_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,15 @@ def setUp(self):
involvement_type=self.github_contribution,
date=datetime.today(),
url="https://example.org",
trainee_notes="Notes from trainee",
)
self.PROGRESS_SUMMARY_BLOCK = (
"<p>"
"<strong>Activity:</strong> Submitted a contribution to a Carpentries "
"repository<br/>"
f'<strong>Date:</strong> {datetime.today().strftime("%B %-d, %Y")}<br/>'
"<strong>URL:</strong> https://example.org<br/>"
"<strong>Notes:</strong> No notes provided"
"<strong>Notes:</strong> Notes from trainee"
"</p>"
)
self.EDIT_CLASS = "edit-object" # class on the Edit button
Expand Down Expand Up @@ -302,6 +303,31 @@ def test_get_involved_asked_to_repeat(self):
self.assertNotContains(rv, self.SESSION_LINK_TEXT)
self.assertContains(rv, "Submit another Get Involved activity")

def test_get_involved_details_not_provided(self):
"""Check that optional fields are summarised correctly when empty"""
self.progress.delete()
TrainingProgress.objects.create(
trainee=self.admin,
requirement=self.get_involved,
involvement_type=self.github_contribution,
state="n",
)

# Act
rv = self.client.get(self.progress_url)

# Assert
PROGRESS_SUMMARY_BLOCK = (
"<p>"
"<strong>Activity:</strong> Submitted a contribution to a Carpentries "
"repository<br/>"
"<strong>Date:</strong> No date provided<br/>"
"<strong>URL:</strong> No URL provided<br/>"
"<strong>Notes:</strong> No notes provided"
"</p>"
)
self.assertContains(rv, PROGRESS_SUMMARY_BLOCK, html=True)


class TestWelcomeSessionStatus(TestBase):
"""Test that trainee dashboard displays status of passing Welcome
Expand Down
2 changes: 1 addition & 1 deletion amy/templates/dashboard/training_progress.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h2>Your progress towards becoming a Carpentries Instructor</h2>
<p>Details of your submission are below.</p>
<p>
<strong>Activity:</strong> {{ progress_get_involved.involvement_type }}<br/>
<strong>Date:</strong> {% firstof progress_get_involved.date "No dates provided" %}<br/>
<strong>Date:</strong> {% firstof progress_get_involved.date|date:'F j, Y' "No date provided" %}<br/>
<strong>URL:</strong> {% firstof progress_get_involved.url "No URL provided" %}<br/>
<strong>Notes:</strong> {% firstof progress_get_involved.trainee_notes "No notes provided" %}
</p>
Expand Down

0 comments on commit bc5a975

Please sign in to comment.