def test_user_does_not_exist_html_contains_no_name(self): expected = "<p>Hi,</p>" response = HttpResponse( create_invitation_html( False, None, self.john.first_name + " " + self.john.last_name, self.group_north.name, "*****@*****.**")) self.assertContains(response, expected, html=True)
def test_user_exists_html_contains_name(self): expected = "<p>Hi Sally,</p>" response = HttpResponse( create_invitation_html( True, self.sally.first_name, self.john.first_name + " " + self.john.last_name, self.group_north.name, self.sally.email)) self.assertContains(response, expected, html=True)
def test_user_does_not_exist_html_contains_correct_link(self): expected_url = settings.CODEWOF_DOMAIN + reverse('account_signup') expected = f"<a href=\"{expected_url}\" style=\"color: #007bff; text-decoration: underline;\">Sign Up</a>" response = HttpResponse( create_invitation_html( False, None, self.john.first_name + " " + self.john.last_name, self.group_north.name, "*****@*****.**")) self.assertContains(response, expected, html=True)
def test_user_exists_html_contains_correct_link(self): expected_url = settings.CODEWOF_DOMAIN + reverse('users:dashboard') expected = f"<a href=\"{expected_url}\" style=\"color: #007bff; text-decoration: underline;\">Sign In</a>" response = HttpResponse( create_invitation_html( True, self.sally.first_name, self.john.first_name + " " + self.john.last_name, self.group_north.name, self.sally.email)) self.assertContains(response, expected, html=True)
def test_user_exists_html_contains_correct_message(self): expected = "<p>John Doe has invited you to join the Group 'Group North'. Click the link below to " \ "sign in. You will see your invitation in the dashboard, where you can join the group.</p>" response = HttpResponse( create_invitation_html( True, self.sally.first_name, self.john.first_name + " " + self.john.last_name, self.group_north.name, self.sally.email)) self.assertContains(response, expected, html=True)
def test_user_does_not_exist_html_contains_correct_message(self): expected = "<p>John Doe has invited you to join the Group 'Group North'. CodeWOF helps you maintain "\ "your programming fitness with short daily programming exercises. With a free account you can "\ "save your progress and track your programming fitness over time. Click the link below to make an "\ "account, using the email [email protected]. You will see your invitation in the dashboard, where "\ "you can join the group. If you already have a CodeWOF account, then add [email protected] to your "\ "profile to make the invitation appear.</p>" response = HttpResponse( create_invitation_html( False, None, self.john.first_name + " " + self.john.last_name, self.group_north.name, "*****@*****.**")) self.assertContains(response, expected, html=True)