1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
""" Various variables used by the tests """
from django.conf import settings
from django.contrib.auth.models import User
from ..accounts.models import Queue
# LDAP directory
DIRECTORY = {
"o=test": {},
"cn=anon,o=test": {
"userPassword": ["{CRYPT}$1$n4jlXi20$.5a8UTvwIqVfVAMlXJ1EZ0"],
},
"cn=Manager,o=test": {
"userPassword": ["{CRYPT}$1$sY4mlRve$0eg5TLYMyZfBCIUgU/RPf0"],
},
"ou=people,o=test": {},
"uid=alice,ou=people,o=test": {
"uid": ["alice"],
"userPassword": ['{CRYPT}$1$lO/RU6zz$2fJCOwurxBtCqdImkoLQo1'],
"objectClass": settings.AUTH_LDAP_USER_OBJECTCLASS +
settings.AUTH_LDAP_DEV_OBJECTCLASS,
"uidNumber": ["1000"],
"gidNumber": ["1000"],
"givenName": ["Alice"],
"sn": ["Adams"],
"cn": ["Alice Adams"],
"mail": ["alice@test.com"],
"gentooRoles": ["kde, qt, cluster"],
"gentooLocation": ["City1, Country1"],
"gentooACL": ["user.group", "developer.group"],
},
"uid=bob,ou=people,o=test": {
"uid": ["bob"],
"userPassword": ['{CRYPT}$1$eFSQMJY6$8y.WUL/ONeEarVXqeCIbH.'],
"objectClass": settings.AUTH_LDAP_USER_OBJECTCLASS,
"uidNumber": ["1001"],
"gidNumber": ["50"],
"givenName": ["Robert"],
"sn": ["Barker"],
"cn": ["Robert Barker"],
"mail": ["bob@test.com"],
"gentoRoles": ["nothing"],
"gentooLocation": ["City2, Country2"],
"gentooACL": ["user.group", "foundation.group"]
},
"uid=jack,ou=people,o=test": {
"uid": ["jack"],
"gentooACL": ["user.group", "developer.group", "foundation.group"],
},
"uid=john,ou=people,o=test": {
"uid": ["john"],
"cn": ["John Smith"],
"gentooLocation": ["City3, Country3"],
"gentooRoles": ["kernel, security"],
"gentooACL": ["user.group", "retired.group"],
},
"uid=matt,ou=people,o=test": {
"gentooACL": ["user.group", "retired.group"],
},
}
# User objects
USER_ALICE = User(username='alice', password='ldaptest')
# Queue objects
QUEUEDUSER = Queue(
username='queueduser',
password='queuedpass',
email='queued_user@test.com',
first_name='queued_first_name',
last_name='queued_last_name',
)
# login form data
LOGIN_ALICE = {'username': 'alice', 'password': 'ldaptest'}
LOGIN_BOB = {'username': 'bob', 'password': 'ldapmoretest'}
LOGIN_WRONG = {'username': 'wrong', 'password': 'wrong'}
# signup form data
SIGNUP_TESTUSER = {
'username': 'testuser',
'first_name': 'testfirstname',
'last_name': 'testlastname',
'email': 'test@test.com',
'password_origin': 'testpassword',
'password_verify': 'testpassword',
}
# SSL certificates
TEST_CERTIFICATE = '''-----BEGIN CERTIFICATE-----
MIICmzCCAiWgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFWDEQ
MA4GA1UECAwHRXhhbXBsZTEQMA4GA1UEBwwHRXhhbXBsZTEQMA4GA1UECgwHRXhh
bXBsZTEUMBIGA1UEAwwLZXhhbXBsZS5jb20xIjAgBgkqhkiG9w0BCQEWE2V4YW1w
bGVAZXhhbXBsZS5jb20wIBcNMTMwODIyMTgzMjIyWhgPMjExMjAzMTYxODMyMjJa
MHAxCzAJBgNVBAYTAkVYMRAwDgYDVQQIDAdFeGFtcGxlMRAwDgYDVQQKDAdFeGFt
cGxlMR4wHAYDVQQDDBVFeGFtcGx1cyBFeGFtcGxpZmljdXMxHTAbBgkqhkiG9w0B
CQEWDmFsaWNlQHRlc3QuY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