Пример #1
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.FisheryFactory()
     self.test_url = reverse_lazy('fisheriescape:fishery_edit',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'fisheriescape/form.html'
     self.user = self.get_and_login_user(in_group="fisheriescape_admin")
Пример #2
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.SpeciesFactory()
     self.test_url = reverse_lazy('fisheriescape:species_delete',
                                  args=[
                                      self.instance.pk,
                                  ])
     self.expected_template = 'fisheriescape/confirm_delete.html'
     self.user = self.get_and_login_user(in_group="fisheriescape_admin")
Пример #3
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.SpeciesFactory()
     self.test_url = reverse_lazy('fisheriescape:species_new')
     self.expected_template = 'fisheriescape/form.html'
     self.user = self.get_and_login_user(in_group="fisheriescape_admin")
Пример #4
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.FisheryFactory()
     self.test_url = reverse_lazy('fisheriescape:fishery_list')
     self.expected_template = 'fisheriescape/list.html'
     self.user = self.get_and_login_user()
Пример #5
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.MarineMammalFactory()
Пример #6
0
 def setUp(self):
     super().setUp()
     self.instance = FactoryFloor.FisheryAreaFactory()
Пример #7
0
 def test_m2m_fishery_areas(self):
     # a `my_model` that is attached to a given `fishery_areas` should be accessible by the m2m field name `fishery_areas`
     fishery_areas = FactoryFloor.FisheryAreaFactory()
     self.instance.fishery_areas.add(fishery_areas)
     self.assertEqual(self.instance.fishery_areas.count(), 1)
     self.assertIn(fishery_areas, self.instance.fishery_areas.all())
Пример #8
0
 def test_m2m_marine_mammal(self):
     # a `my_model` that is attached to a given `marine_mammals` should be accessible by the m2m field name `marine_mammals`
     marine_mammals = FactoryFloor.MarineMammalFactory()
     self.instance.marine_mammals.add(marine_mammals)
     self.assertEqual(self.instance.marine_mammals.count(), 1)
     self.assertIn(marine_mammals, self.instance.marine_mammals.all())