Ticket #4151: tests.py

File tests.py, 1.3 KB (added by Nick Efford <nick@…>, 17 years ago)

doctests for the patched check_password function

Line 
1# Tests of check_password function
2
3"""
4>>> from django.contrib.auth.models import check_password
5
6>>> check_password('hello', 'sha1$b58c0$6ab58c27e867939bea0557555de0a4dad2e6450b')
7True
8>>> check_password('hallo', 'sha1$b58c0$6ab58c27e867939bea0557555de0a4dad2e6450b')
9False
10>>> check_password('hello', 'sha256$b58c0$6ab58c27e867939bea0557555de0a4dad2e6450b')
11False
12>>> check_password('hello', 'sha1$c58c0$6ab58c27e867939bea0557555de0a4dad2e6450b')
13False
14>>> check_password('hello', 'sha1$b58c0$7ab58c27e867939bea0557555de0a4dad2e6450b')
15False
16
17>>> check_password('hello', 'sha256$b58c0$6ee3346be81c210d176fa4e1618fb354c3bfe00203e553be15f3234ed1d79479')
18True
19>>> check_password('hallo', 'sha256$b58c0$6ee3346be81c210d176fa4e1618fb354c3bfe00203e553be15f3234ed1d79479')
20False
21>>> check_password('hello', 'sha1$b58c0$6ee3346be81c210d176fa4e1618fb354c3bfe00203e553be15f3234ed1d79479')
22False
23>>> check_password('hello', 'sha256$c58c0$6ee3346be81c210d176fa4e1618fb354c3bfe00203e553be15f3234ed1d79479')
24False
25>>> check_password('hello', 'sha256$b58c0$7ee3346be81c210d176fa4e1618fb354c3bfe00203e553be15f3234ed1d79479')
26False
27
28>>> check_password('hello', 'sha224$b58c0$2eeb852c7a6e590a0fd61602e382457fea74c33961ca15c8d480a80d')
29True
30>>> check_password('hello', 'sha384$b58c0$a9cc26418db64c0b1bf77ac2ad8110108b2998fd1c628eb7c625d0b9fdb7e97fd944c126a290c948167ed3346fba5373')
31True
32"""
Back to Top