Exemple #1
0
    def test_admin_url(self):
        self.env['PATH_INFO'] = '/test'
        self.env['REQUEST_METHOD'] = 'get'
        self.assertTrue(auth(self.env, 'admin', 'password'))

        self.env['PATH_INFO'] = '/winterfell'
        self.env['REQUEST_METHOD'] = 'get'
        self.assertTrue(auth(self.env, 'admin', 'password'))

        self.env['PATH_INFO'] = '/winterfell/x'
        self.env['REQUEST_METHOD'] = 'post'
        self.assertTrue(auth(self.env, 'admin', 'password'))
Exemple #2
0
    def test_user_url(self):
        self.env['PATH_INFO'] = '/test'
        self.env['REQUEST_METHOD'] = 'get'
        self.assertTrue(auth(self.env, 'jon_snow', 'password'))

        self.env['PATH_INFO'] = '/winterfell'
        self.env['REQUEST_METHOD'] = 'get'
        self.assertTrue(auth(self.env, 'jon_snow', 'password'))

        self.env['PATH_INFO'] = '/winterfell'
        self.env['REQUEST_METHOD'] = 'post'
        self.assertFalse(auth(self.env, 'jon_snow', 'password'))

        self.env['PATH_INFO'] = '/castleblack'
        self.env['REQUEST_METHOD'] = 'post'
        self.assertTrue(auth(self.env, 'jon_snow', 'password'))
Exemple #3
0
 def test_wrong_url(self):
     self.env['PATH_INFO'] = 'xxx'
     self.env['REQUEST_METHOD'] = 'get'
     self.assertFalse(auth(self.env, 'admin', 'password'))
     self.env['REQUEST_METHOD'] = 'put'
     self.assertFalse(auth(self.env, 'admin', 'password'))
Exemple #4
0
 def test_wrong_password(self):
     self.env['PATH_INFO'] = ''
     self.env['REQUEST_METHOD'] = 'get'
     
     self.assertFalse(auth(self.env, 'admin', 'wrong'))