def test_get_action_html_with_verb_action_target(self): """ Tests get_action_html() with a verb, action and target, that the html output is correct. """ self.group = Group.objects.create( name='Some group' ) self.action = Action.objects.create( actor=self.user, verb='invited', action=self.user2, target=self.group, timestamp=timezone.now() - timedelta(days=2) ) expected = ( '<span class="action-actor">test_bob</span>' '<span class="action-verb">invited</span>' '<span class="action-action">test_gary</span>' ' to ' '<span class="action-target">Some group</span>' '<span class="action-timestamp">2 days ago</span>' ) result = get_action_html(self.action) self.assertHTMLEqual(expected, result)
def test_get_action_html_with_verb(self): """ Tests get_action_html() with a verb, that the html output is correct. """ self.action = Action.objects.create(actor=self.user, verb="joined the website") expected = ( '<span class="action-actor">test_bob</span>' '<span class="action-verb">joined the website</span>' '<span class="action-timestamp">now</span>' ) result = get_action_html(self.action) self.assertHTMLEqual(expected, result)
def test_get_action_html_with_verb(self): """ Tests get_action_html() with a verb, that the html output is correct. """ self.action = Action.objects.create( actor=self.user, verb='joined the website' ) expected = ( '<span class="action-actor">test_bob</span>' '<span class="action-verb">joined the website</span>' '<span class="action-timestamp">now</span>' ) result = get_action_html(self.action) self.assertHTMLEqual(expected, result)
def test_get_action_html_with_verb_action(self): """ Tests get_action_html() with a verb and action, that the html output is correct. """ self.action = Action.objects.create( actor=self.user, verb="made friends with", action=self.user2, timestamp=timezone.now() - timedelta(days=2) ) expected = ( '<span class="action-actor">test_bob</span>' '<span class="action-verb">made friends with</span>' '<span class="action-action">test_gary</span>' '<span class="action-timestamp">2 days ago</span>' ) result = get_action_html(self.action).strip() self.assertHTMLEqual(expected, result)
def test_get_action_html_with_verb_action(self): """ Tests get_action_html() with a verb and action, that the html output is correct. """ self.action = Action.objects.create( actor=self.user, verb='made friends with', action=self.user2, timestamp=timezone.now() - timedelta(days=2) ) expected = ( '<span class="action-actor">test_bob</span>' '<span class="action-verb">made friends with</span>' '<span class="action-action">test_gary</span>' '<span class="action-timestamp">2 days ago</span>' ) result = get_action_html(self.action).strip() self.assertHTMLEqual(expected, result)
def test_get_action_html_with_verb_action_target(self): """ Tests get_action_html() with a verb, action and target, that the html output is correct. """ self.group = Group.objects.create(name="Some group") self.action = Action.objects.create( actor=self.user, verb="invited", action=self.user2, target=self.group, timestamp=timezone.now() - timedelta(days=2), ) expected = ( '<span class="action-actor">test_bob</span>' '<span class="action-verb">invited</span>' '<span class="action-action">test_gary</span>' " to " '<span class="action-target">Some group</span>' '<span class="action-timestamp">2 days ago</span>' ) result = get_action_html(self.action) self.assertHTMLEqual(expected, result)