Beispiel #1
0
    def test_search_view_form_invalid(self):
        """Test the generic SearchView form is invalid."""
        v = SearchView()
        v.kwargs = {}
        v.request = self.request

        form = v.get_form(v.get_form_class())
        response = v.form_invalid(form)
        context = response.context_data

        self.assertTrue('query' not in context)
Beispiel #2
0
    def test_search_view_form_valid(self):
        """Test the generic SearchView form is valid."""
        v = SearchView()
        v.kwargs = {}
        v.request = self.request

        form = v.get_form(v.get_form_class())
        response = v.form_valid(form)
        context = response.context_data

        self.assertEqual(context['query'], self.query)