def test_existing_identifier_no_category(self): # config["motions_identifier_with_blank"] = True conflicting_motion = Motion( title="test_title_al2=2k21fjv1lsck3ehlWExg", text="test_text_3omvpEhnfg082ejplk1m", ) conflicting_motion.save() conflicting_motion.identifier = "test_C3-2-1" conflicting_motion.save() response = self.client.post(reverse("category-numbering", args=[self.A.pk])) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual("test_C3-2-1", response.data["args"][0])
def test_existing_identifier_with_category(self): conflicting_category = Category.objects.create( name="test_name_hpsodhakvjdbvkblwfjr") conflicting_motion = Motion( title="test_title_al2=2k21fjv1lsck3ehlWExg", text="test_text_3omvpEhnfg082ejplk1m", category=conflicting_category, ) conflicting_motion.save() conflicting_motion.identifier = "test_C3-2-1" conflicting_motion.save() response = self.client.post( reverse("category-numbering", args=[self.A.pk])) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual("test_C3-2-1", response.data["args"][0]) self.assertEqual(conflicting_category.name, response.data["args"][1])