# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/patterns_app/models.py
# class IdentifiedModel(patterns.IdentifiedModel):
#     pass


from .base import APITestCase
from rest_framework import status
from django.contrib.auth.models import User
from tests.patterns_app.models import IdentifiedModel
from wq.db.patterns.models import Authority
        self.assertIsNotNone(ident)
        self.assertEqual(ident.slug, 'test-4')
        ident.slug = 'test-4-update'
        ident.name = 'Test 4 Update'
        ident.save()
        instance = IdentifiedModel.objects.get(pk=instance.pk)
        self.assertEqual(instance.slug, 'test-4-update')
        self.assertEqual(instance.name, 'Test 4 Update')
        instance.slug = "test-4-update-2"
        instance.name = "Test 4 Update 2"
        instance.save()
        self.assertEqual(instance.primary_identifier.slug, 'test-4-update-2')
        self.assertEqual(instance.primary_identifier.name, 'Test 4 Update 2')

    def test_identify_autocreate(self):
        """
        Deleting identifier and re-saving should create a new one.
        """
        instance = IdentifiedModel.objects.create(
            name="Test 1",
        )

        instance.identifiers.all().delete()
        self.assertIsNone(instance.primary_identifier)
        instance.save()
        self.assertIsNotNone(instance.primary_identifier)

        self.assertEqual(instance.primary_identifier.slug, "test-1")



# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/patterns_app/models.py
# class IdentifiedModel(patterns.IdentifiedModel):
#     pass


# Path: tests/test_identify.py
from .base import APITestCase
from rest_framework import status
from django.contrib.auth.models import User
from tests.patterns_app.models import IdentifiedModel
from wq.db.patterns.models import Authority

        self.assertIsNotNone(ident)
        self.assertEqual(ident.slug, 'test-4')
        ident.slug = 'test-4-update'
        ident.name = 'Test 4 Update'
        ident.save()
        instance = IdentifiedModel.objects.get(pk=instance.pk)
        self.assertEqual(instance.slug, 'test-4-update')
        self.assertEqual(instance.name, 'Test 4 Update')
        instance.slug = "test-4-update-2"
        instance.name = "Test 4 Update 2"
        instance.save()
        self.assertEqual(instance.primary_identifier.slug, 'test-4-update-2')
        self.assertEqual(instance.primary_identifier.name, 'Test 4 Update 2')

    def test_identify_autocreate(self):
        """
        Deleting identifier and re-saving should create a new one.
        """
        instance = IdentifiedModel.objects.create(
            name="Test 1",
        )

        instance.identifiers.all().delete()
        self.assertIsNone(instance.primary_identifier)
        instance.save()
        self.assertIsNotNone(instance.primary_identifier)

        self.assertEqual(instance.primary_identifier.slug, "test-1")



class IdentifyRestTestCase(APITestCase):