a
    Dg		                     @   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   sD   dD ]2}zdD ]}t j| |= qW q ty4   Y q0 qt   d S )N)Zwagtailcorezwagtail.tests)ZdraftstatewithoutrevisionmodelZ draftstateincorrectrevisionmodelZdraftstatewithrevisionmodel)r   Z
all_modelsKeyErrorclear_cache)selfpackagemodel r   ]/var/www/lab.imftr.de/x/nb_venv/lib/python3.9/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                   @   s   e Zd ZdS )zWTestDraftStateMixin.test_missing_revision_mixin.<locals>.DraftStateWithoutRevisionModelN__name__
__module____qualname__r   r   r   r   DraftStateWithoutRevisionModel   s   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                   @   s   e Zd ZdS )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                   @   s   e Zd ZdS )zKTestDraftStateMixin.test_correct_model.<locals>.DraftStateWithRevisionModelNr   r   r   r   r   DraftStateWithRevisionModel=   s   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)Zdjango.appsr   Zdjango.corer   Z	django.dbr   Zdjango.testr   Zwagtail.modelsr   r   r   r   r   r   r   <module>   s
   