Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mattia Rizzolo
nm.debian.org
Commits
769cc8c9
Commit
769cc8c9
authored
Apr 21, 2020
by
Enrico Zini
Browse files
Fixed the remaining tests. refs:
#5
parent
dae96feb
Changes
1
Hide whitespace changes
Inline
Side-by-side
dsa/tests/test_housekeeping.py
View file @
769cc8c9
...
...
@@ -44,12 +44,10 @@ class TestCheckLDAPConsistency(ProcessFixtureMixin, TestCase):
res
=
list
(
Inconsistency
.
objects
.
all
())
self
.
assertEqual
(
len
(
res
),
len
(
items
))
for
inc
,
item
in
zip
(
res
,
items
):
person
=
item
.
get
(
"person"
)
if
person
is
not
None
:
self
.
assertEqual
(
inc
.
person
,
person
)
text
=
item
.
get
(
"text"
)
if
text
is
not
None
:
self
.
assertEqual
(
inc
.
text
,
text
)
if
"person"
in
item
:
self
.
assertEqual
(
inc
.
person
,
item
[
"person"
])
if
"text"
in
item
:
self
.
assertEqual
(
inc
.
text
,
item
[
"text"
])
def
test_new_removed
(
self
):
with
mock
.
patch
(
"dsa.udldap.list_people"
)
as
m
:
...
...
@@ -57,10 +55,11 @@ class TestCheckLDAPConsistency(ProcessFixtureMixin, TestCase):
MockEntry
(
"newdd"
,
supplementaryGid
=
[
"Debian"
],
cn
=
"tcn"
,
mn
=
"tmn"
,
sn
=
"tsn"
,
emailForward
=
"test@example.org"
,
accountStatus
=
None
)
]
self
.
hk
.
run
(
CheckLDAPConsistency
)
self
.
assertInconsistenciesEqual
([
{
"person"
:
self
.
persons
.
newdd
,
"text"
:
"newdd: created to mirror a removed DD account from LDAP"
},
with
self
.
assertLogs
()
as
log
:
self
.
hk
.
run
(
CheckLDAPConsistency
)
self
.
assertEqual
(
log
.
output
,
[
"WARNING:dsa.housekeeping:test.CheckLDAPConsistency:"
" newdd: created to mirror a removed DD account from LDAP"
,
])
p
=
Person
.
objects
.
get
(
ldap_fields__uid
=
"newdd"
)
...
...
@@ -85,7 +84,8 @@ class TestCheckLDAPConsistency(ProcessFixtureMixin, TestCase):
with
self
.
assertLogs
()
as
log
:
self
.
hk
.
run
(
CheckLDAPConsistency
)
self
.
assertEqual
(
log
.
output
,
[
"WARNING:dsa.housekeeping:test.CheckLDAPConsistency: newguest: created to mirror a removed guest account from LDAP"
])
"WARNING:dsa.housekeeping:test.CheckLDAPConsistency:"
" newguest: created to mirror a removed guest account from LDAP"
])
p
=
Person
.
objects
.
get
(
ldap_fields__uid
=
"newguest"
)
audit
=
[
"{}:{}"
.
format
(
l
.
author
.
lookup_key
,
l
.
notes
)
for
l
in
p
.
audit_log
.
all
()]
...
...
@@ -109,8 +109,8 @@ class TestCheckLDAPConsistency(ProcessFixtureMixin, TestCase):
]
self
.
hk
.
run
(
CheckLDAPConsistency
)
self
.
assertInconsistenciesEqual
([
{
"person"
:
self
.
persons
.
newdd
,
"text"
:
"
person
has fingerprint 66B4DFB68CB24EBBD8650BC4F4B4B0CC797EBFAB and gid 800 in LDAP,"
{
"person"
:
None
,
"text"
:
"
newdd
has fingerprint 66B4DFB68CB24EBBD8650BC4F4B4B0CC797EBFAB and gid 800 in LDAP,"
" but is not in our db"
},
])
...
...
@@ -250,11 +250,14 @@ class TestCheckLDAPConsistency(ProcessFixtureMixin, TestCase):
with
self
.
assertLogs
()
as
log
:
self
.
hk
.
run
(
CheckLDAPConsistency
)
self
.
assertEqual
(
log
.
output
,
[
"WARNING:dsa.housekeeping:None: dd_u has accountStatus 'retiring 2018-03-20' "
'(comment: None) but in our db the state is Debian Developer, uploading '
'[retiring]'
,
"INFO:dsa.housekeeping:None: dd_u changing email_ldap from dd_u@example.org to test@example.org"
" (source: LDAP)"
,
"INFO:dsa.housekeeping:test.CheckLDAPConsistency: dd_u changing email_ldap"
" from dd_u@example.org to test@example.org (source: LDAP)"
,
])
self
.
assertInconsistenciesEqual
([
{
"person"
:
self
.
persons
.
dd_u
,
"text"
:
"person has accountStatus 'retiring 2018-03-20' "
'(comment: None) but in our db the state is Debian Developer, uploading '
'[retiring]'
},
])
process
.
approved_by
=
self
.
persons
.
dam
...
...
@@ -263,7 +266,7 @@ class TestCheckLDAPConsistency(ProcessFixtureMixin, TestCase):
with
self
.
assertLogs
()
as
log
:
self
.
hk
.
run
(
CheckLDAPConsistency
)
self
.
assertEqual
(
log
.
output
,
[
"INFO:dsa.housekeeping:
None
: dd_u closed from dsa: retiring 2018-03-20"
,
"INFO:dsa.housekeeping:
test.CheckLDAPConsistency
: dd_u closed from dsa: retiring 2018-03-20"
,
])
p
=
self
.
persons
.
dd_u
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment