Пример #1
0
    def test_htpasswd_passwd_auth_wrongpass(self):
        from lwp.authenticators.htpasswd import htpasswd

        with open('/var/lwp/htpasswd', 'w') as file_pass:
            file_pass.write('user_test:L2HG274hqrFwo\n')

        h = htpasswd()
        user = h.authenticate('user_test', 'wrong_pass')
        assert user == None
Пример #2
0
    def test_htpasswd_passwd_auth_wrongpass(self):
        from lwp.authenticators.htpasswd import htpasswd

        with open('/var/lwp/htpasswd', 'w') as file_pass:
            file_pass.write('user_test:L2HG274hqrFwo\n')

        h = htpasswd()
        user = h.authenticate('user_test', 'wrong_pass')
        assert user == None
Пример #3
0
    def test_htpasswd_passwd_auth(self):
        # FIXME the config mock is ovewrite by lwp.app load
        #       align test file to default example.conf
        #global config
        #config = MagicMock()
        #config.get('htpasswd', 'file', return_value='/var/lwp/htpasswd')
        from lwp.authenticators.htpasswd import htpasswd

        with open('/var/lwp/htpasswd', 'w') as file_pass:
            file_pass.write('user_test:L2HG274hqrFwo\n')

        h = htpasswd()
        user = h.authenticate('user_test', 'pass')
        assert user.get('username') == 'user_test'
Пример #4
0
    def test_htpasswd_passwd_auth(self):
        # FIXME the config mock is ovewrite by lwp.app load
        #       align test file to default example.conf
        #global config
        #config = MagicMock()
        #config.get('htpasswd', 'file', return_value='/var/lwp/htpasswd')
        from lwp.authenticators.htpasswd import htpasswd

        with open('/var/lwp/htpasswd', 'w') as file_pass:
            file_pass.write('user_test:L2HG274hqrFwo\n')

        h = htpasswd()
        user = h.authenticate('user_test', 'pass')
        assert user.get('username') == 'user_test'