annotate MoinMoin/support/passlib/tests/test_apps.py @ 6130:7f0616feeae9

upgrade passlib to 1.7.1, update CHANGES
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 11 Apr 2017 22:53:58 +0200
parents
children
rev   line source
6130
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 """test passlib.apps"""
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 #=============================================================================
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 # imports
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4 #=============================================================================
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 from __future__ import with_statement
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 # core
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 import logging; log = logging.getLogger(__name__)
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 # site
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 # pkg
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10 from passlib import apps, hash as hashmod
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 from passlib.tests.utils import TestCase
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 # module
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 #=============================================================================
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 # test predefined app contexts
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16 #=============================================================================
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 class AppsTest(TestCase):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 """perform general tests to make sure contexts work"""
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 # NOTE: these tests are not really comprehensive,
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 # since they would do little but duplicate
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 # the presets in apps.py
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 #
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 # they mainly try to ensure no typos
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24 # or dynamic behavior foul-ups.
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 def test_master_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 ctx = apps.master_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 self.assertGreater(len(ctx.schemes()), 50)
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 def test_custom_app_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 ctx = apps.custom_app_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 self.assertEqual(ctx.schemes(), ("sha512_crypt", "sha256_crypt"))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 ('$6$rounds=41128$VoQLvDjkaZ6L6BIE$4pt.1Ll1XdDYduEwEYPCMOBiR6W6'
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
35 'znsyUEoNlcVXpv2gKKIbQolgmTGe6uEEVJ7azUxuc8Tf7zV9SD2z7Ij751'),
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
36 ('$5$rounds=31817$iZGmlyBQ99JSB5n6$p4E.pdPBWx19OajgjLRiOW0itGny'
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
37 'xDGgMlDcOsfaI17'),
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
39 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 def test_django16_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
42 ctx = apps.django16_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
43 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
44 'pbkdf2_sha256$29000$ZsgquwnCyBs2$fBxRQpfKd2PIeMxtkKPy0h7SrnrN+EU/cm67aitoZ2s=',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
45 'sha1$0d082$cdb462ae8b6be8784ef24b20778c4d0c82d5957f',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
46 'md5$b887a$37767f8a745af10612ad44c80ff52e92',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
47 'crypt$95a6d$95x74hLDQKXI2',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
48 '098f6bcd4621d373cade4e832627b4f6',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
49 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
50 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
51
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 self.assertEqual(ctx.identify("!"), "django_disabled")
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53 self.assertFalse(ctx.verify("test", "!"))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
54
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
55 def test_django_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56 ctx = apps.django_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58 'pbkdf2_sha256$29000$ZsgquwnCyBs2$fBxRQpfKd2PIeMxtkKPy0h7SrnrN+EU/cm67aitoZ2s=',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
59 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
60 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
61
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62 self.assertEqual(ctx.identify("!"), "django_disabled")
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 self.assertFalse(ctx.verify("test", "!"))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
65 def test_ldap_nocrypt_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66 ctx = apps.ldap_nocrypt_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
67 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
68 '{SSHA}cPusOzd6d5n3OjSVK3R329ZGCNyFcC7F',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 'test',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
70 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
71 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
72
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
73 self.assertIs(ctx.identify('{CRYPT}$5$rounds=31817$iZGmlyBQ99JSB5'
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
74 'n6$p4E.pdPBWx19OajgjLRiOW0itGnyxDGgMlDcOsfaI17'), None)
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 def test_ldap_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77 ctx = apps.ldap_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
78 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79 ('{CRYPT}$5$rounds=31817$iZGmlyBQ99JSB5n6$p4E.pdPBWx19OajgjLRiOW0'
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
80 'itGnyxDGgMlDcOsfaI17'),
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
81 '{SSHA}cPusOzd6d5n3OjSVK3R329ZGCNyFcC7F',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
82 'test',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
83 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
84 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86 def test_ldap_mysql_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 ctx = apps.mysql_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89 '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
90 '378b243e220ca493',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
92 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
93
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
94 def test_postgres_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95 ctx = apps.postgres_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 hash = 'md55d9c68c6c50ed3d02a2fcf54f63993b6'
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 self.assertTrue(ctx.verify("test", hash, user='user'))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 def test_phppass_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100 ctx = apps.phpass_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 '$P$8Ja1vJsKa5qyy/b3mCJGXM7GyBnt6..',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
103 '$H$8b95CoYQnQ9Y6fSTsACyphNh5yoM02.',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
104 '_cD..aBxeRhYFJvtUvsI',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
105 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108 h1 = "$2a$04$yjDgE74RJkeqC0/1NheSSOrvKeu9IbKDpcQf/Ox3qsrRS/Kw42qIS"
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 if hashmod.bcrypt.has_backend():
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110 self.assertTrue(ctx.verify("test", h1))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111 self.assertEqual(ctx.default_scheme(), "bcrypt")
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
112 self.assertEqual(ctx.handler().name, "bcrypt")
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 else:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 self.assertEqual(ctx.identify(h1), "bcrypt")
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 self.assertEqual(ctx.default_scheme(), "phpass")
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 self.assertEqual(ctx.handler().name, "phpass")
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
117
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 def test_phpbb3_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119 ctx = apps.phpbb3_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
120 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121 '$P$8Ja1vJsKa5qyy/b3mCJGXM7GyBnt6..',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122 '$H$8b95CoYQnQ9Y6fSTsACyphNh5yoM02.',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
123 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
124 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
125 self.assertTrue(ctx.hash("test").startswith("$H$"))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
126
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
127 def test_roundup_context(self):
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
128 ctx = apps.roundup_context
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
129 for hash in [
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
130 '{PBKDF2}9849$JMTYu3eOUSoFYExprVVqbQ$N5.gV.uR1.BTgLSvi0qyPiRlGZ0',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
131 '{SHA}a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
132 '{CRYPT}dptOmKDriOGfU',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
133 '{plaintext}test',
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
134 ]:
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
135 self.assertTrue(ctx.verify("test", hash))
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
136
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
137 #=============================================================================
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
138 # eof
7f0616feeae9 upgrade passlib to 1.7.1, update CHANGES
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
139 #=============================================================================