o
    h		                     @   sT   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	m
Z
 G dd deZdS )	    )apps)checks)models)TestCase)DraftStateMixinRevisionMixinc                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestDraftStateMixinc              	   C   sB   dD ]}zdD ]}t j| |= qW q ty   Y qw t   d S )N)wagtailcorezwagtail.tests)draftstatewithoutrevisionmodel draftstateincorrectrevisionmodeldraftstatewithrevisionmodel)r   
all_modelsKeyErrorclear_cache)selfpackagemodel r   ^/var/www/html/ndineBlogger/venv/lib/python3.10/site-packages/wagtail/tests/test_draft_model.pytearDown
   s   zTestDraftStateMixin.tearDownc              	   C   s8   G dd dt tj}| | tjdd|ddg d S )Nc                   @      e Zd ZdS )zWTestDraftStateMixin.test_missing_revision_mixin.<locals>.DraftStateWithoutRevisionModelN__name__
__module____qualname__r   r   r   r   DraftStateWithoutRevisionModel       r   KDraftStateMixin requires RevisionMixin to be applied after DraftStateMixin.DAdd RevisionMixin to the model's base classes after DraftStateMixin.wagtailcore.E004hintobjid)r   r   ModelassertEqualcheckr   Error)r   r   r   r   r   test_missing_revision_mixin   s   z/TestDraftStateMixin.test_missing_revision_mixinc              	   C   s:   G dd dt ttj}| | tjdd|ddg d S )Nc                   @   r   )zaTestDraftStateMixin.test_incorrect_revision_mixin_order.<locals>.DraftStateIncorrectRevisionModelNr   r   r   r   r    DraftStateIncorrectRevisionModel+   s    r)   r   r   r   r    )r   r   r   r$   r%   r&   r   r'   )r   r)   r   r   r   #test_incorrect_revision_mixin_order*   s   
z7TestDraftStateMixin.test_incorrect_revision_mixin_orderc                 C   s*   G dd dt ttj}| | g  d S )Nc                   @   r   )zKTestDraftStateMixin.test_correct_model.<locals>.DraftStateWithRevisionModelNr   r   r   r   r   DraftStateWithRevisionModel=   r   r+   )r   r   r   r$   r%   r&   )r   r+   r   r   r   test_correct_model<   s   z&TestDraftStateMixin.test_correct_modelN)r   r   r   r   r(   r*   r,   r   r   r   r   r   	   s
    r   N)django.appsr   django.corer   	django.dbr   django.testr   wagtail.modelsr   r   r   r   r   r   r   <module>   s    