o
    h=}                     @   sF  d dl Z d dlmZmZ 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 d dlmZmZmZ d d	lmZ d d
lmZ G dd dZG dd deeeZG dd deeeZG dd deeeZG dd deeeZG dd deeeZG dd deeeZG dd deeeZG dd deeeZG dd deeeZdS )    N)Group
Permission)ContentType)TestCase)reverse)AdminURLFinder)Document)
CollectionCollectionViewRestrictionGroupCollectionPermission)WagtailTestUtils)AdminTemplateTestUtilsc                   @   s   e Zd Zdd ZdS )CollectionInstanceTestUtilsc                 C   s   t jt}tjj|dd| _tjj|dd| _tjj|dd| _tjjdd}t	 | _
| j
jdd| _| j
jd	d| _| jjd
d| _| jjdd| _tjjdd| _| jj| | jddd| _| jj| j dS )zY
        Common setup for testing collection views with per-instance permissions
        add_collection)content_typecodenamechange_collectiondelete_collectionaccess_admin)r   Financename	MarketingDigital MarketingDirect Mail MarketingzMarketing Group	marketingpasswordr   N)r   objectsget_for_modelr	   r   getadd_permissionchange_permissiondelete_permissionget_first_root_noderoot_collection	add_childfinance_collectionmarketing_collectionmarketing_sub_collectionmarketing_sub_collection_2r   createmarketing_grouppermissionsaddcreate_usermarketing_usergroups)selfcollection_content_typeadmin_permission r5   j/var/www/html/ndineBlogger/venv/lib/python3.10/site-packages/wagtail/admin/tests/test_collections_views.pysetUp   s0   
z!CollectionInstanceTestUtils.setUpN)__name__
__module____qualname__r7   r5   r5   r5   r6   r      s    r   c                   @   s8   e Zd Zdd Zi fddZdd Zdd Zd	d
 ZdS )#TestCollectionsIndexViewAsSuperuserc                 C   s   |    d S N)loginr2   r5   r5   r6   r7   7   s   z)TestCollectionsIndexViewAsSuperuser.setUpc                 C      | j td|S Nwagtailadmin_collections:indexclientr    r   r2   paramsr5   r5   r6   r    :      z'TestCollectionsIndexViewAsSuperuser.getc                 C   s   |   }| |jd | |d | |d t }|jdd| _|   }| |jd | |d | 	|d | |d | 
dddg|j d S )	N   zwagtailadmin/generic/index.htmlz!No collections have been created.Holiday snapsr    Collectionsurllabel)r    assertEqualstatus_codeassertTemplateUsedassertContainsr	   r$   r&   
collectionassertNotContainsassertBreadcrumbsItemsRenderedcontent)r2   responser%   r5   r5   r6   test_simple=   s   z/TestCollectionsIndexViewAsSuperuser.test_simplec                 C   sX   t  }|jdd |jdd |jdd |  }| dd |jd D g d d S )	NMilkr   BreadAvocadoc                 S      g | ]}|j qS r5   r   .0rR   r5   r5   r6   
<listcomp>[       zETestCollectionsIndexViewAsSuperuser.test_ordering.<locals>.<listcomp>object_list)rZ   rY   rX   r	   r$   r&   r    rN   context)r2   r%   rV   r5   r5   r6   test_orderingS   s   z1TestCollectionsIndexViewAsSuperuser.test_orderingc                 C   s|   t  }|jdd}|jdd |jdd |jdd}|jdd |jdd |  }| dd	 |jd
 D g d d S )N	Vegetabler   SpinachCucumberAnimalDogCatc                 S   r[   r5   r   r\   r5   r5   r6   r^   o   r_   zLTestCollectionsIndexViewAsSuperuser.test_nested_ordering.<locals>.<listcomp>r`   )rg   ri   rh   rd   rf   re   ra   )r2   r%   
vegetablesanimalsrV   r5   r5   r6   test_nested_ordering_   s   z8TestCollectionsIndexViewAsSuperuser.test_nested_orderingN)r8   r9   r:   r7   r    rW   rc   rl   r5   r5   r5   r6   r;   4   s    r;   c                       sP   e Zd Z fddZi fddZdd Zdd Zd	d
 Zdd Zdd Z	  Z
S )TestCollectionsIndexViewc                       t    | j| jdd d S Nr   r   superr7   r=   r0   r>   	__class__r5   r6   r7   u      
zTestCollectionsIndexView.setUpc                 C   r?   r@   rB   rD   r5   r5   r6   r    y   rF   zTestCollectionsIndexView.getc                 C   ,   |   }| |jd | |jd d d S N.  message6Sorry, you do not have permission to access this area.r    rN   rO   rb   r2   rV   r5   r5   r6   "test_marketing_user_no_permissions|      z;TestCollectionsIndexView.test_marketing_user_no_permissionsc                 C   j   t jj| j| j| jd |  }| |jd | dd |j	d D g d | 
|d | 
|d d S )	NgrouprR   
permissionrG   c                 S   r[   r5   r   r\   r5   r5   r6   r^      r_   zWTestCollectionsIndexView.test_marketing_user_with_change_permission.<locals>.<listcomp>r`   r   r   r   r   Add a collection)r   r   r+   r,   r(   r"   r    rN   rO   rb   rS   r{   r5   r5   r6   *test_marketing_user_with_change_permission      zCTestCollectionsIndexView.test_marketing_user_with_change_permissionc                 C   sj   t jj| j| j| jd |  }| |jd | dd |j	d D g d | 
|d | |d d S )	Nr   rG   c                 S   r[   r5   r   r\   r5   r5   r6   r^      r_   zTTestCollectionsIndexView.test_marketing_user_with_add_permission.<locals>.<listcomp>r`   r   r   r   )r   r   r+   r,   r(   r!   r    rN   rO   rb   rS   rQ   r{   r5   r5   r6   'test_marketing_user_with_add_permission   r   z@TestCollectionsIndexView.test_marketing_user_with_add_permissionc                 C   r~   )	Nr   rG   c                 S   r[   r5   r   r\   r5   r5   r6   r^      r_   zWTestCollectionsIndexView.test_marketing_user_with_delete_permission.<locals>.<listcomp>r`   r   r   r   )r   r   r+   r,   r(   r#   r    rN   rO   rb   rS   r{   r5   r5   r6   *test_marketing_user_with_delete_permission   r   zCTestCollectionsIndexView.test_marketing_user_with_delete_permissionc                 C   s^   t jj| j| j| jd |  }| |jd | dd |j	d D g d | 
|d d S )Nr   rG   c                 S   r[   r5   r   r\   r5   r5   r6   r^      r_   z\TestCollectionsIndexView.test_marketing_user_with_add_permission_on_root.<locals>.<listcomp>r`   )r   r   r   r   r   )r   r   r+   r,   r%   r!   r    rN   rO   rb   rQ   r{   r5   r5   r6   /test_marketing_user_with_add_permission_on_root   s   zHTestCollectionsIndexView.test_marketing_user_with_add_permission_on_root)r8   r9   r:   r7   r    r|   r   r   r   r   __classcell__r5   r5   rr   r6   rm   t   s    rm   c                   @   s<   e Zd Zdd Zi fddZi fddZdd Zd	d
 ZdS )TestAddCollectionAsSuperuserc                 C   s   |    t | _d S r<   )r=   r	   r$   r%   r>   r5   r5   r6   r7      s   z"TestAddCollectionAsSuperuser.setUpc                 C   r?   Nzwagtailadmin_collections:addrB   rD   r5   r5   r6   r       rF   z TestAddCollectionAsSuperuser.getc                 C   r?   r   rC   postr   r2   	post_datar5   r5   r6   r      rF   z!TestAddCollectionAsSuperuser.postc                 C   sH   |   }| |jd | || jj | ddddddg|j d S )NrG   rJ   /admin/collections/)rM   rL   zNew: CollectionrI   )r    rN   rO   rQ   r%   r   rT   rU   r{   r5   r5   r6   test_get   s   z%TestAddCollectionAsSuperuser.test_getc                 C   s^   |  d| jjd}| |td | tjjdd	 d | tjj
dd | j d S )NrH   r   parentrA   r      )r   r%   idassertRedirectsr   rN   r	   r   filtercountr    
get_parentr{   r5   r5   r6   	test_post   s   z&TestAddCollectionAsSuperuser.test_postN)r8   r9   r:   r7   r    r   r   r   r5   r5   r5   r6   r      s    r   c                       sL   e Zd Z fddZi fddZi fddZdd Zd	d
 Zdd Z  Z	S )TestAddCollectionc                    rn   ro   rp   r>   rr   r5   r6   r7      rt   zTestAddCollection.setUpc                 C   r?   r   rB   rD   r5   r5   r6   r       rF   zTestAddCollection.getc                 C   r?   r   r   r   r5   r5   r6   r      rF   zTestAddCollection.postc                 C   ru   rv   rz   r{   r5   r5   r6   r|      r}   z4TestAddCollection.test_marketing_user_no_permissionsc                 C   sv   t jj| j| j| jd | d| jjd}| |t	d | 
tjjdd d | 
tjjdd | j d S )Nr   Affiliate Marketingr   rA   r   r   )r   r   r+   r,   r(   r!   r   r   r   r   rN   r	   r   r   r    r   r{   r5   r5   r6   r     s$   z9TestAddCollection.test_marketing_user_with_add_permissionc                 C   sJ   t jj| j| j| jd | d| jjd}| 	|j
d jd dg d S )Nr   r   r   formr   zGSelect a valid choice. That choice is not one of the available choices.)r   r   r+   r,   r(   r!   r   r%   r   rN   rb   errorsr{   r5   r5   r6   6test_marketing_user_cannot_add_outside_their_hierarchy!  s   zHTestAddCollection.test_marketing_user_cannot_add_outside_their_hierarchy)
r8   r9   r:   r7   r    r   r|   r   r   r   r5   r5   rr   r6   r      s    r   c                   @   sh   e Zd Zdd Zi dfddZi dfddZdd	 Zd
d Zdd Zdd Z	dd Z
dd Zdd ZdS )TestEditCollectionAsSuperuserc                 C   sX   |   | _t | _| jjdd| _| jjdd| _| jjdd| _| jjdd| _	d S )NrH   r   zLevel 1Level 2zLevel 3)
r=   userr	   r$   r%   r&   rR   l1l2l3r>   r5   r5   r6   r7   7  s   

z#TestEditCollectionAsSuperuser.setUpNc                 C       | j td|p
| jjfd|S Nwagtailadmin_collections:editargsrC   r    r   rR   r   r2   rE   collection_idr5   r5   r6   r    ?     z!TestEditCollectionAsSuperuser.getc                 C   r   r   rC   r   r   rR   r   r2   r   r   r5   r5   r6   r   H  r   z"TestEditCollectionAsSuperuser.postc                 C   s\   |   }| |jd td| jjfd}| || | ddddt| jdg|j	 d S )NrG   wagtailadmin_collections:deleter   r   rJ   rK   rI   )
r    rN   rO   r   rR   r   rQ   rT   strrU   r2   rV   
delete_urlr5   r5   r6   r   Q  s   z&TestEditCollectionAsSuperuser.test_getc                 C   "   | j | jjd}| |jd d S Nr     r    r%   r   rN   rO   r{   r5   r5   r6    test_cannot_edit_root_collectiona     z>TestEditCollectionAsSuperuser.test_cannot_edit_root_collectionc                 C   s.   d| j j }t| j}| || j | d S )Nz/admin/collections/%d/)r   pkr   r   rN   get_edit_url)r2   expected_url
url_finderr5   r5   r6   test_admin_url_findere  s   
z3TestEditCollectionAsSuperuser.test_admin_url_finderc                 C      | j dd}| |jd d S Ni r   r   r    rN   rO   r{   r5   r5   r6   test_get_nonexistent_collectionj     z=TestEditCollectionAsSuperuser.test_get_nonexistent_collectionc                 C   sB   |  d| jjd| jj | tjj| jjd j| jj d S )Nr   r   r   )	r   r%   r   r   rN   r	   r   r    r   r>   r5   r5   r6   test_move_collectionn  s
   z2TestEditCollectionAsSuperuser.test_move_collectionc                 C   s<   |  d| jjd| jj}| |jd d | |d d S )Nr   r   rx   z0The collection could not be saved due to errors.zPlease select another parent)r   r   r   r   rN   rb   rQ   r{   r5   r5   r6   0test_cannot_move_parent_collection_to_descendantu  s   zNTestEditCollectionAsSuperuser.test_cannot_move_parent_collection_to_descendantc                 C   sN   d| j jd}| || jj}| |td | tj	j
| jjdjd d S )NzSkiing photosr   rA   r   )r%   r   r   rR   r   r   r   rN   r	   r   r    r   )r2   datarV   r5   r5   r6   test_rename_collection}  s   z4TestEditCollectionAsSuperuser.test_rename_collection)r8   r9   r:   r7   r    r   r   r   r   r   r   r   r   r5   r5   r5   r6   r   6  s    		r   c                       s   e Zd Z fddZi fddZi fddZdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Z  ZS )TestEditCollectionc                    sR   t    tjj| j| j| jd| _tjj| j| j| j	d| _
| j| jdd d S Nr   r   r   )rq   r7   r   r   r+   r,   r(   r"   users_change_permissionr!   users_add_permissionr=   r0   r>   rr   r5   r6   r7     s   
zTestEditCollection.setUpc                 C      | j td|fd|S r   rB   r2   r   rE   r5   r5   r6   r         zTestEditCollection.getc                 C   r   r   r   r2   r   r   r5   r5   r6   r     r   zTestEditCollection.postc                 C   s>   | j   | j| jjd}| |jd | |jd d d S )Nr   rw   rx   ry   )r   deleter    r(   r   rN   rO   rb   r{   r5   r5   r6   (test_marketing_user_no_change_permission     
z;TestEditCollection.test_marketing_user_no_change_permissionc                 C   s>   | j   | | jji }| |jd | |jd d d S rv   )r   r   r   r(   r   rN   rO   rb   r{   r5   r5   r6   -test_marketing_user_no_change_permission_post  r   z@TestEditCollection.test_marketing_user_no_change_permission_postc                 C   s   | j | jjd}| |jd |jd j}| t|d jj	d | t|d jj	d | 
| jjd| jjd	 | tjj | jjd
jd | tjj | jjd
 | j d S )Nr   rG   r   r   	TextInputr   SelectWithDisabledOptionsNew Collection Namer   r   )r    r)   r   rN   rO   rb   fieldstypewidgetr8   r   r   r*   r	   r   r   r   )r2   rV   form_fieldsr5   r5   r6   'test_marketing_user_can_move_collection  s*   z:TestEditCollection.test_marketing_user_can_move_collectionc                 C   sJ   | j   | j| jjd}| |jd | t|jd j	
 dg d S )Nr   rG   r   r   )r   r   r    r)   r   rN   rO   listrb   r   keysr{   r5   r5   r6   ?test_marketing_user_cannot_move_collection_if_no_add_permission  s   
"zRTestEditCollection.test_marketing_user_cannot_move_collection_if_no_add_permissionc                 C   sZ   | j   | | jjd| jjd tjj| jj	d}| 
|jd | 
| | j d S Nr   r   r   )r   r   r   r)   r   r*   r	   r   r    r   rN   r   r   r(   )r2   edited_collectionr5   r5   r6   Dtest_marketing_user_cannot_move_collection_if_no_add_permission_post  s   
zWTestEditCollection.test_marketing_user_cannot_move_collection_if_no_add_permission_postc                 C   s>   |  | jjd| jjd | tjj| jjd | j	 d S r   )
r   r(   r   r*   rN   r	   r   r    r   r%   r>   r5   r5   r6   r     s   zCTestEditCollection.test_cannot_move_parent_collection_to_descendantc                 C   sv   t jj| j| j| jd | j| jjd}| 	|j
d | 	t|jd j dg td| jjfd}| || d S )Nr   r   rG   r   r   r   r   )r   r   r+   r,   r'   r!   r    r(   r   rN   rO   r   rb   r   r   r   rS   r   r5   r5   r6   Ftest_marketing_user_cannot_move_collection_permissions_are_assigned_to  s   zYTestEditCollection.test_marketing_user_cannot_move_collection_permissions_are_assigned_toc                 C      | j   |   d S r<   )r   r   r   r>   r5   r5   r6   Otest_cannot_move_collection_permissions_are_assigned_to_with_minimal_permission     
zbTestEditCollection.test_cannot_move_collection_permissions_are_assigned_to_with_minimal_permissionc                 C   s   t jj| j| j| jd | | jjd| jjd | 	t
jj| jjd | j | | jj| jj| jjd | 	t
jj| jjd | j d S )Nr   z	Moved Subr   r   )r   r   r+   r,   r'   r!   r   r)   r   rN   r	   r    r   r   r(   r   r%   r>   r5   r5   r6   Ktest_marketing_user_cannot_move_collection_permissions_are_assigned_to_post
  s.   z^TestEditCollection.test_marketing_user_cannot_move_collection_permissions_are_assigned_to_postc                 C   r   r<   )r   r   r   r>   r5   r5   r6   Ttest_cannot_move_collection_permissions_are_assigned_to_with_minimal_permission_post*  r   zgTestEditCollection.test_cannot_move_collection_permissions_are_assigned_to_with_minimal_permission_postc                 C   s   t d| jjfd}| j| jjd}| || tjj| j| j	| j
d | j| jjd}| || tjj| j| j| j
d | j| jjd}| || d S )Nr   r   r   r   )r   r)   r   r    rS   r   r   r+   r,   r*   r#   r(   rQ   )r2   r   rV   r5   r5   r6   4test_page_shows_delete_link_only_if_delete_permitted2  s(   zGTestEditCollection.test_page_shows_delete_link_only_if_delete_permitted)r8   r9   r:   r7   r    r   r   r   r   r   r   r   r   r   r   r   r   r   r5   r5   rr   r6   r     s    		 r   c                   @   sx   e Zd Zdd Zi dfddZi dfddZdd	 Zd
d Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )TestDeleteCollectionAsSuperuserc                 C   s&   |    t | _| jjdd| _d S )NrH   r   )r=   r	   r$   r%   r&   rR   r>   r5   r5   r6   r7   T  s   
z%TestDeleteCollectionAsSuperuser.setUpNc                 C   r   Nr   r   r   r   r5   r5   r6   r    Y  r   z#TestDeleteCollectionAsSuperuser.getc                 C   r   r   r   r   r5   r5   r6   r   b  r   z$TestDeleteCollectionAsSuperuser.postc                 C   s2   |   }| |jd | |d | |j d S )NrG   (wagtailadmin/generic/confirm_delete.html)r    rN   rO   rP   assertBreadcrumbsNotRenderedrU   r{   r5   r5   r6   r   k  s   z(TestDeleteCollectionAsSuperuser.test_getc                 C   r   r   r   r{   r5   r5   r6   "test_cannot_delete_root_collectionq  r   zBTestDeleteCollectionAsSuperuser.test_cannot_delete_root_collectionc                 C   r   r   r   r{   r5   r5   r6   r   u  r   z?TestDeleteCollectionAsSuperuser.test_get_nonexistent_collectionc                 C   s8   t jjd| jd |  }| |jd | |d d S )NTest documenttitlerR   rG   .wagtailadmin/collections/delete_not_empty.html)r   r   r+   rR   r    rN   rO   rP   r{   r5   r5   r6   test_get_nonempty_collectiony  s   z<TestDeleteCollectionAsSuperuser.test_get_nonempty_collectionc                 C   s:   | j jtddd |  }| |jd | |d d S )NTest collectionr   instancerG   r   )rR   r&   r	   r    rN   rO   rP   r{   r5   r5   r6   #test_get_collection_with_descendent  s   zCTestDeleteCollectionAsSuperuser.test_get_collection_with_descendentc                 C   sn   |   }| |td | |jd d | tj tjj	| j
jd W d    d S 1 s0w   Y  d S )NrA   rx   z#Collection 'Holiday snaps' deleted.r   )r   r   r   rN   rb   assertRaisesr	   DoesNotExistr   r    rR   r   r{   r5   r5   r6   r     s   "z)TestDeleteCollectionAsSuperuser.test_postc                 C   sD   t jjd| jd |  }| |jd | tjj	| jj
d d S )Nr   r     r   )r   r   r+   rR   r   rN   rO   
assertTruer	   r    r   r{   r5   r5   r6   test_post_nonempty_collection  s   z=TestDeleteCollectionAsSuperuser.test_post_nonempty_collectionc                 C   sF   | j jtddd |  }| |jd | tjj| j j	d d S )Nr   r   r   r   r   )
rR   r&   r	   r   rN   rO   r   r   r    r   r{   r5   r5   r6   $test_post_collection_with_descendant  s   zDTestDeleteCollectionAsSuperuser.test_post_collection_with_descendantc                 C   sD   | j   | j| jjd}| |jd | tj	j
| jjd d S )Nr   r   r   )rR   r   r   r%   r   rN   rO   r   r	   r   r    r{   r5   r5   r6   test_post_root_collection  s   
z9TestDeleteCollectionAsSuperuser.test_post_root_collection)r8   r9   r:   r7   r    r   r   r   r   r   r   r   r   r   r  r5   r5   r5   r6   r   Q  s    						r   c                       st   e Zd Z fddZi fddZi fddZdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Z  ZS )TestDeleteCollectionc                    s8   t    tjj| j| j| jd| _| j	| j
dd d S r   )rq   r7   r   r   r+   r,   r(   r#   users_delete_permissionr=   r0   r>   rr   r5   r6   r7     s   
zTestDeleteCollection.setUpc                 C   r   r   rB   r   r5   r5   r6   r      r   zTestDeleteCollection.getc                 C   r   r   r   r   r5   r5   r6   r     r   zTestDeleteCollection.postc                 C   s.   | j | jjd}| |jd | |d d S )Nr   rG   r   )r    r)   r   rN   rO   rP   r{   r5   r5   r6   r     s   zTestDeleteCollection.test_getc                 C   sd   | j | jjd}| |td | tj tjj	| jjd W d    d S 1 s+w   Y  d S )Nr   rA   r   )
r   r)   r   r   r   r   r	   r   r   r    r{   r5   r5   r6   r     s
   "zTestDeleteCollection.test_postc                 C       |  | jj}| |jd d S Nr   )r    r'   r   rN   rO   r{   r5   r5   r6   +test_cannot_delete_someone_elses_collection     z@TestDeleteCollection.test_cannot_delete_someone_elses_collectionc                 C   s8   |  | jj}| |jd | tjj| j	jd d S Nr   r   )
r   r'   r   rN   rO   r   r	   r   r    r)   r{   r5   r5   r6   0test_cannot_delete_someone_elses_collection_post     zETestDeleteCollection.test_cannot_delete_someone_elses_collection_postc                 C   r  r  )r    r(   r   rN   rO   r{   r5   r5   r6   ,test_cannot_delete_their_own_root_collection  r  zATestDeleteCollection.test_cannot_delete_their_own_root_collectionc                 C   s8   |  | jj}| |jd | tjj| jjd d S r  )	r   r(   r   rN   rO   r   r	   r   r    r{   r5   r5   r6   1test_cannot_delete_their_own_root_collection_post  r
  zFTestDeleteCollection.test_cannot_delete_their_own_root_collection_postc                 C   s@   | j jtddd | | j j}| |jd | |d d S )NAnother collectionr   r   rG   r   )r)   r&   r	   r    r   rN   rO   rP   r{   r5   r5   r6   .test_cannot_delete_collection_with_descendants  s   zCTestDeleteCollection.test_cannot_delete_collection_with_descendantsc                 C   sL   | j jtddd | | j j}| |jd | tjj	| j jd d S )Nr  r   r   r   r   )
r)   r&   r	   r   r   rN   rO   r   r   r    r{   r5   r5   r6   3test_cannot_delete_collection_with_descendants_post  s   zHTestDeleteCollection.test_cannot_delete_collection_with_descendants_post)r8   r9   r:   r7   r    r   r   r   r  r	  r  r  r  r  r   r5   r5   rr   r6   r    s    
	r  c                       s0   e Zd Z fddZi fddZdd Z  ZS )TestSetCollectionPrivacyc                    s   t    |   d S r<   )rq   r7   r=   r>   rr   r5   r6   r7     s   
zTestSetCollectionPrivacy.setUpc                 C   r   )Nz$wagtailadmin_collections:set_privacyr   rB   r   r5   r5   r6   r    
  s   zTestSetCollectionPrivacy.getc                 C   s   t jj| jddd | | jj}| |jd | 	|d | 
|d | t|jd }| |d | |d	 |d
}td| jjfd}| |d| d S )Nr   password123)rR   restriction_typer   rG   z5wagtailadmin/collection_privacy/ancestor_privacy.htmlz=This collection has been made private by a parent collection.htmlheaderh1ar   r   href)r
   r   r+   r%   r    r)   r   rN   rO   rP   rQ   get_soupjsonloadsrU   assertIsNone
select_oner   )r2   rV   souplinkparent_edit_urlr5   r5   r6   test_get_private_child  s.   
z/TestSetCollectionPrivacy.test_get_private_child)r8   r9   r:   r7   r    r   r   r5   r5   rr   r6   r    s    r  ) r  django.contrib.auth.modelsr   r   "django.contrib.contenttypes.modelsr   django.testr   django.urlsr   wagtail.admin.admin_url_finderr   wagtail.documents.modelsr   wagtail.modelsr	   r
   r   wagtail.test.utilsr   !wagtail.test.utils.template_testsr   r   r;   rm   r   r   r   r   r   r  r  r5   r5   r5   r6   <module>   s2    
!@U*CT 
HfN