def test_list_without_spam(self): """Test that entries marked as spam do not show up.""" s = suggestion(state=Suggestion.STATE_SPAM, save=True) resp = self.client.get(reverse('suggestions-list')) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'suggestions/suggestions_list.html') assert s.name not in resp.content
def test_wipe_resolved_date_when_reopened(self): """Test that date is reset when the suggestion is reopened.""" s = suggestion(save=True, state=Suggestion.STATE_COMPLETED) assert s.resolved is not None s.state = Suggestion.STATE_NEW s.save() assert s.resolved is None
def test_not_reviewed_list(self): """Test the view of the listing of all suggestions.""" s = suggestion(save=True) resp = self.client.get(reverse('suggestions-list')) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'suggestions/suggestions_list.html') assert s.name not in resp.content
def test_resolved_date_set_upon_save(self): """Test that the date is set when the suggestion is closed.""" s = suggestion(save=True) assert s.resolved is None s.state = Suggestion.STATE_COMPLETED s.save() assert s.resolved is not None
def test_no_resolved_date_for_open_states(self): """Test that the date is not set when the state is not closed.""" s = suggestion(save=True) assert s.resolved is None s.state = Suggestion.STATE_IN_PROGRESS s.save() assert s.resolved is None
def test_not_reviewed_list(self): """Test the view of the listing of all suggestions.""" s = suggestion(save=True) resp = self.client.get(reverse('suggestions-list')) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'suggestions/suggestions_list.html') self.assertNotContains(resp, s.name)
def test_list_without_spam(self): """Test that entries marked as spam do not show up.""" s = suggestion(state=Suggestion.STATE_SPAM, save=True) resp = self.client.get(reverse('suggestions-list')) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'suggestions/suggestions_list.html') self.assertNotContains(resp, s.name)
def test_reviewed_list(self): """Test the view of the listing of all suggestions.""" s = suggestion(save=True) s.is_reviewed = True s.save() resp = self.client.get(reverse('suggestions-list')) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'suggestions/suggestions_list.html') self.assertContains(resp, s.name)
def test_reviewed_list(self): """Test the view of the listing of all suggestions.""" s = suggestion(save=True) s.is_reviewed = True s.save() resp = self.client.get(reverse('suggestions-list')) eq_(resp.status_code, 200) self.assertTemplateUsed(resp, 'suggestions/suggestions_list.html') assert s.name in resp.content
def test_mark_if_spam_with_words(self): # handle name s = suggestion(name='1 foo 2', comment='1 bar 2', save=True) utils.mark_if_spam(s) eq_(s.state, Suggestion.STATE_SPAM) # handle comment s = suggestion(name='1 bar 2', comment='1 foo 2', save=True) utils.mark_if_spam(s) eq_(s.state, Suggestion.STATE_SPAM) # not case-sensitive s = suggestion(name='1 FOO 2', comment='1 FOO 2', save=True) utils.mark_if_spam(s) eq_(s.state, Suggestion.STATE_SPAM) # don't flag superstrings s = suggestion(name='1 food 2', comment='1 food 2', save=True) utils.mark_if_spam(s) eq_(s.state, Suggestion.STATE_NEW)
def test_mark_if_spam_no_spam_words(self): s = suggestion(name='foo', comment='foo', save=True) utils.mark_if_spam(s) eq_(s.state, Suggestion.STATE_NEW)