o
    .j                     @   s  d Z ddlZddlmZmZmZmZ ddlmZ dd Z	dd Z
d	d
 Zdd Zejdd Zejdd Zejeegddd Zejdd Zdd Zdd Zdd Zdd Zdd Zd ed!efd"d#Zd ed!efd$d%Zejeegdd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zd2d3 Zej !d4d5d6d7ifd8d9d:ifd;d<d=ifgd>d? Z"ej !d4d5d6g ifd8d9g ifd;d<g ifgd@dA Z#ej !dBg dCdDdE Z$dS )FzTest conference properties.    N)CalendarEventTodovUri)
Conferencec                  C   sJ   t td} | jdksJ | jdu sJ | jdu sJ | jdu s#J dS )zTest creation from a URI.(https://chat.example.com/audio?id=123456Nr   from_urir   urifeaturelabellanguage
conference r   Y/home/thesage/.local/lib/python3.10/site-packages/icalendar/tests/prop/test_conference.pytest_from_empty_uri	   s
   r   c                  C   sV   t tdddddd} | jdksJ | jdksJ | jdks"J | jdks)J dS )z(Create a conference with lots of values.r   zPHONE,MODERATORModerator dial-inENFEATURELABELLANGUAGEparamsNr   r   r   r   r   test_from_example_uri   s   
r   c                  C   sH   t ddddddd} t| }| }|| ksJ |j| jks"J dS )	zTest creating a vURI.r   PHONE	ModeratorDEURI)r   r   r   VALUEr   N)r   r   r	   to_urir   )r
   r   new_urir   r   r   test_to_uri$   s   
	r#   c                  C   sV   t dddgdd} |  }t|jd tsJ |jd dks J |jd dks)J d	S )
zKEnsure list parameters are correctly serialized to comma-separated strings.https://example.comAUDIOVIDEOzMeeting room)r
   r   r   r   zAUDIO,VIDEOr   N)r   r!   
isinstancer   strconfvurir   r   r   )test_conference_list_params_serialization5   s   
r,   c                   C   s   t tdS )$Fixture for a conference with a URI.r   )r   r	   r   r   r   r   r   conference_1B   s   r.   c                   C   s   t tdddddS )r-   r   r   r   r   )r   r   r   )r   r   r   r   r   r   conference_2H   s   r/   r   c                 C   s   | j S )z)Fixture to create a Conference component.)param)requestr   r   r   component_classS      r2   c                 C   s   |  S )zCreate a component.r   )r2   r   r   r   	componentY   r3   r4   c                 C   s   | j g ksJ d| vsJ dS )zNo conferences by default.
CONFERENCENconferences)r4   r   r   r   test_no_conferences_   s   r8   c                 C   s    |g| _ | d | ksJ dS zAdd a new conference.r5   Nr7   r!   )r4   r.   r   r   r   test_add_conferencee   s   r;   c                 C   s*   ||g| _ | d | | gksJ dS r9   r:   )r4   r.   r/   r   r   r   test_add_multiple_conferencesk   s   
 r<   c                 C   s&   | j ||gd}|j||gksJ dS )z(Create a new component with conferences.r6   N)newr7   )r2   r.   r/   r4   r   r   r   #test_new_component_with_conferencesq   s   r>   c                 C   s>   | g|_ | d}d|v sJ d|v sJ d|v sJ dS )z$The URI start be in the ical string.zutf-8zCONFERENCE;z/audio?id=123456r   N)r7   to_icaldecode)r/   r4   ical_strr   r   r   test_uri_in_ical_w   s
   rB   calendarreturnc                 C   s
   | j d S zGet the event directlyr   )events)rC   r   r   r   	get_event   s   
rG   c                 C   s   t |  }|jd S rE   )r   	from_icalr?   rF   )rC   calr   r   r   get_serialized_event   s   
rJ   c                 C   s   |j }| |S )zReturn the event from the file.)rfc_7986_conferencesr0   )r1   	calendarsrC   r   r   r   event_with_conferences   s   
rM   c                 C   s   t | jdks	J | jd jdksJ | jd jdksJ | jd jdks'J | jd jd	ks1J | jd
 jdks;J | jd
 jddgksGJ | jd
 jdksQJ | jd
 jdu s[J dS )z*The conferences should be in the calendar.   r   ztel:+1-412-555-0123,,,654321   ztel:+1-412-555-0123,,,555123   ztel:+1-888-555-0456,,,555123   z$xmpp:chat-123@conference.example.com   r   r%   r&   zAttendee dial-inN)lenr7   r
   r   r   r   )rM   r   r   r   test_conferences_from_file   s   

rT   c                  C   sF   t d} | jdksJ | jdu sJ | jdu sJ | jdu s!J dS )z"Create a conference from a string.ztel:+1-412-555-0123N)r   r	   r
   r   r   r   r   r   r   r   test_conference_from_string   s
   
rU   c                  C   s$   t d} |  }|jdksJ dS )z;Conference created from a string should add the value type.z
http://asdr   N)r   r	   r!   r    )r   r
   r   r   r   $test_from_uri_string_adds_value_type      
rV   c                  C   s*   t ddd} |  }|jd dksJ dS )z=A string feature should be kept as-is, not wrapped in a list.r$   r%   r
   r   r   Nr   r!   r   r)   r   r   r   test_string_feature_passthrough   s   rZ   c                  C   s&   t dg d} |  }d|jvsJ dS )z=An empty list feature should be omitted from params entirely.r$   rX   r   NrY   r)   r   r   r    test_empty_list_feature_filtered   s   r[   c                  C   s$   t dd} |  }d|jvsJ dS )z+A None feature should not appear in params.r$   r
   r   NrY   r)   r   r   r   test_none_feature_omitted   rW   r]   )
param_namekwargsr   r   r%   r   r   zRoom Ar   r   r   c                 C   s<   t dddi|}| }|j|  t| d ksJ dS )zMString values for feature, label, and language should pass through unchanged.r
   r$   r   Nr   )r   r!   r   listvaluesr^   r_   r*   r+   r   r   r   "test_string_passthrough_all_params   s   
"rc   c                 C   s,   t dddi|}| }| |jvsJ dS )zKEmpty lists for feature, label, and language should be omitted from params.r
   r$   Nr   rY   rb   r   r   r   #test_empty_list_filtered_all_params   s   
rd   r^   r   c                 C   s$   t dd}| }| |jvsJ dS )zINone values for feature, label, and language should not appear in params.r$   r\   NrY   )r^   r*   r+   r   r   r   test_none_omitted_all_params   s   
re   )%__doc__pytest	icalendarr   r   r   r   icalendar.prop.conferencer   r   r   r#   r,   fixturer.   r/   r2   r4   r8   r;   r<   r>   rB   rG   rJ   rM   rT   rU   rV   rZ   r[   r]   markparametrizerc   rd   re   r   r   r   r   <module>   sb    	




	
	







