diff options
| -rw-r--r-- | archaeological_finds/models_treatments.py | 2 | ||||
| -rw-r--r-- | ishtar_common/tests.py | 27 | 
2 files changed, 24 insertions, 5 deletions
| diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index e94d1c272..57ab530bf 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -177,7 +177,7 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):          if menu_filtr:              if 'treatmentfile' in menu_filtr:                  replace_query = Q(file=menu_filtr['treatmentfile']) -            if 'find' in menu_filtr: +            if 'find' in menu_filtr and 'basket' not in menu_filtr['find']:                  q = Q(upstream=menu_filtr['find']) | Q(                      downstream=menu_filtr['find'])                  if replace_query: diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 9e5fc3466..c128dd93a 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -626,15 +626,18 @@ class ShortMenuTest(TestCase):          self.assertEqual(response.status_code, 200)          self.assertFalse(str(tf.cached_label) in response.content) -    def testTreatment(self): -        c = Client() -        c.login(username=self.username, password=self.password) +    def _create_treatment(self):          from archaeological_finds.models import Treatment -        treat = Treatment.objects.create( +        return Treatment.objects.create(              label="My treatment",              year=2052          ) +    def testTreatment(self): +        c = Client() +        c.login(username=self.username, password=self.password) +        treat = self._create_treatment() +          # not available at first          response = c.get(reverse('shortcut-menu'))          self.assertEqual(response.status_code, 200) @@ -684,6 +687,22 @@ class ShortMenuTest(TestCase):          self.assertFalse(c.session['find'])          self.assertFalse(c.session['contextrecord']) +        self._create_treatment() + +    def test_basket_hierarchy_with_treatments(self): +        c = Client() +        c.login(username=self.username, password=self.password) +        from archaeological_finds.models import FindBasket +        basket = FindBasket.objects.create( +            label="My basket", +            user=self.user.ishtaruser +        ) +        session = c.session +        session['find'] = 'basket-{}'.format(basket.pk) +        session.save() +        response = c.get(reverse('shortcut-menu')) +        self.assertEqual(response.status_code, 200) +  class ImportTest(TestCase):      def testDeleteRelated(self): | 
