ó
ù2¢\c           @   sL   d  Z  d d l Z d d l m Z d d l m Z d e f d „  ƒ  YZ d S(   s   Tests for login redirectsiÿÿÿÿN(   t
   url_concat(   t   NotebookTestBaset	   LoginTestc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c      	   C   s–   t  j |  j ƒ  d ƒ } | j ƒ  t  j t |  j ƒ  d i | d 6ƒ d t d i |  j d 6| j j d d ƒ d 6d | j ƒ} | j ƒ  | j	 d	 S(
   Nt   logint   nextt   allow_redirectst   datat   passwordt   _xsrft    t   cookiest   Location(
   t   requestst   gett   base_urlt   raise_for_statust   postR    t   Falset   tokenR
   t   headers(   t   selfR   t   firstt   resp(    (    s=   lib/python2.7/site-packages/notebook/auth/tests/test_login.pyR   
   s    


c         C   sc   xP d d |  j  d d d d d f D]+ } |  j d | ƒ } |  j | |  j  ƒ q$ W| s_ t ‚ d  S(	   Ns   //some-hosts   //hostt   trees   https://google.coms   /absolute/not/base_urls   ///jupyter.orgs   /\some-hostR   (   t
   url_prefixR   t   assertEqualt   AssertionError(   R   t   bad_nextt   url(    (    s=   lib/python2.7/site-packages/notebook/auth/tests/test_login.pyt   test_next_bad   s    c         C   so   xh d |  j  ƒ  d d d f D]J } d | k r8 | } n |  j | } |  j d | ƒ } |  j | | ƒ q Wd  S(   Ns   tree/s   has/hosts   notebooks/notebook.ipynbs   tree//somethings   ://R   (   R   R   R   R   (   R   t	   next_patht   expectedt   actual(    (    s=   lib/python2.7/site-packages/notebook/auth/tests/test_login.pyt   test_next_ok)   s    	(   t   __name__t
   __module__R   R   R!   (    (    (    s=   lib/python2.7/site-packages/notebook/auth/tests/test_login.pyR   	   s   		(   t   __doc__R   t   tornado.httputilR    t   notebook.tests.launchnotebookR   R   (    (    (    s=   lib/python2.7/site-packages/notebook/auth/tests/test_login.pyt   <module>   s   