ó
A()Qc           @  s   d  d l  m Z d  d l m Z m 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 e f d	     YZ d
 S(   i˙˙˙˙(   t   unicode_literals(   t   check_passwordt   groups_for_user(   t   Usert   Group(   t
   CustomUser(   t   skipIfCustomUser(   t   TransactionTestCase(   t   override_settingst   ModWsgiHandlerTestCasec           B  sD   e  Z d  Z e d    Z e d d  d    Z e d    Z RS(   u7   
    Tests for the mod_wsgi authentication handler
    c         C  sŁ   t  j j d d d  |  j t i  d d  d k  |  j t i  d d   t  j j d d  j d t  |  j	 t i  d d   |  j	 t i  d d   d S(	   uł   
        Verify that check_password returns the correct values as per
        http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms#Apache_Authentication_Provider
        u   testu   test@example.comu   unknownu    t   usernamet	   is_activeu	   incorrectN(
   R   t   objectst   create_usert
   assertTrueR   t   Nonet   filtert   updatet   Falset   assertFalse(   t   self(    (    s;   ../Django//lib/python/django/contrib/auth/tests/handlers.pyt   test_check_password   s    t   AUTH_USER_MODELu   auth.CustomUserc         C  sk   t  j j d d d  |  j t i  d d  d k  |  j t i  d d   |  j t i  d d   d S(   u×   
        Verify that check_password returns the correct values as per
        http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms#Apache_Authentication_Provider

        with custom user installed
        u   test@example.comu
   1990-01-01u   testu   unknownu    u	   incorrectN(   R   t   _default_managerR   R   R   R   R   (   R   (    (    s;   ../Django//lib/python/django/contrib/auth/tests/handlers.pyt   test_check_password_custom_user$   s    	c         C  sĽ   t  j j d d d  } t  j j d d d  t j j d d  } | j j |  |  j t i  d  g   |  j t i  d  d g  |  j t i  d  g   d	 S(
   uŤ   
        Check that groups_for_user returns correct values as per
        http://code.google.com/p/modwsgi/wiki/AccessControlMechanisms#Apache_Group_Authorisation
        u   testu   test@example.comu   test1u   test1@example.comt   nameu
   test_groupu   unknownt
   test_groupN(	   R   R   R   R   t   createt   groupst   addt   assertEqualR   (   R   t   user1t   group(    (    s;   ../Django//lib/python/django/contrib/auth/tests/handlers.pyt   test_groups_for_user8   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   R!   (    (    (    s;   ../Django//lib/python/django/contrib/auth/tests/handlers.pyR	      s   N(   t
   __future__R    t$   django.contrib.auth.handlers.modwsgiR   R   t   django.contrib.auth.modelsR   R   t   django.contrib.auth.testsR   t   django.contrib.auth.tests.utilsR   t   django.testR   t   django.test.utilsR   R	   (    (    (    s;   ../Django//lib/python/django/contrib/auth/tests/handlers.pyt   <module>   s   