def METHOD_NAME(self):
    """delete attachment type is not allowed if it has attachments associated"""
    self.client.post(
        reverse("misago:admin:settings:attachment-types:new"),
        data={
            "name": "Test type",
            "extensions": ".test",
            "size_limit": 0,
            "status": AttachmentType.ENABLED,
        },
    )
    test_type = AttachmentType.objects.order_by("id").last()
    self.assertEqual(test_type.name, "Test type")
    test_type.attachment_set.create(
        secret="loremipsum",
        filetype=test_type,
        uploader_name="User",
        uploader_slug="user",
        filename="test.zip",
        file="sad76asd678as687sa.zip",
    )
    action_link = reverse(
        "misago:admin:settings:attachment-types:delete", kwargs={"pk": test_type.pk}
    )
    response = self.client.post(action_link)
    self.assertEqual(response.status_code, 302)
    # get alert form database
    AttachmentType.objects.get(pk=test_type.pk)