Beispiel #1
0
 def test_multiple_simple(self):
     """Form data has three simple."""
     data = MultiDict({"searchtype": "title", "query": "foo title"})
     form = SimpleSearchForm(data)
     query = simple._query_from_form(form)
     self.assertIsInstance(query, SimpleQuery,
                           "Should return an instance of SimpleQuery")
Beispiel #2
0
 def test_form_data_has_order(self):
     """Form data includes sort order."""
     data = MultiDict({
         "searchtype": "title",
         "query": "foo title",
         "order": "submitted_date",
     })
     form = SimpleSearchForm(data)
     query = simple._query_from_form(form)
     self.assertIsInstance(query, SimpleQuery,
                           "Should return an instance of SimpleQuery")
     self.assertEqual(query.order, "submitted_date")
Beispiel #3
0
 def test_form_data_has_no_order(self):
     """Form data includes sort order parameter, but it is 'None'."""
     data = MultiDict({
         'searchtype': 'title',
         'query': 'foo title',
         'order': 'None'    #
     })
     form = SimpleSearchForm(data)
     query = simple._query_from_form(form)
     self.assertIsInstance(query, SimpleQuery,
                           "Should return an instance of SimpleQuery")
     self.assertIsNone(query.order, "Order should be None")
Beispiel #4
0
 def test_form_data_has_order(self):
     """Form data includes sort order."""
     data = MultiDict({
         'searchtype': 'title',
         'query': 'foo title',
         'order': 'submitted_date'
     })
     form = SimpleSearchForm(data)
     query = simple._query_from_form(form)
     self.assertIsInstance(query, SimpleQuery,
                           "Should return an instance of SimpleQuery")
     self.assertEqual(query.order, 'submitted_date')