diff options
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 65a5a7593..bd1833594 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -1273,6 +1273,34 @@ class ShortMenuTest(TestCase): self.assertEqual(response.status_code, 200) self.assertFalse(str(treat.cached_label) in response.content) + def test_pin_search(self): + c = Client() + c.login(username=self.username, password=self.password) + base_find, find = self._create_find() + + response = c.post( + reverse('pin-search', args=['find']), + {'value': 'Where is my find'}, + **{'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'} + ) + self.assertEqual(response.status_code, 200) + # the selected find search is pined + self.assertEqual(c.session['pin-search-find'], 'Where is my find') + + # empty search save means empty dependant search + c.get( + reverse('pin', args=['contextrecord', + str(base_find.context_record.pk)]) + ) + response = c.post( + reverse('pin-search', args=['find']), + {'value': ''}, + **{'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'} + ) + self.assertEqual(response.status_code, 200) + self.assertEqual(c.session['pin-search-find'], '') + self.assertEqual(c.session['contextrecord'], '') + def test_update_current_item(self): c = Client() c.login(username=self.username, password=self.password) |