Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Fachschaftsrat Physik TUKL
Protokoll
protokoll_skript
Commits
3aa97008
Commit
3aa97008
authored
Jul 27, 2018
by
Lorenz Steinert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ldap.Connection no mocked
parent
bc7b54e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
bin/module/test.py
bin/module/test.py
+7
-2
No files found.
bin/module/test.py
View file @
3aa97008
...
...
@@ -32,9 +32,14 @@ class FsrLdapTest(unittest.TestCase):
open
(
"/tmp/python3-esme-testing/fsr_extern"
,
'a'
).
close
()
self
.
sharedir
=
"/tmp/python3-esme-testing"
self
.
conn
=
ldap
.
Connection
(
self
.
test_ldap_server
.
server
,
client_strategy
=
ldap
.
MOCK_SYNC
)
self
.
conn_non
=
ldap
.
Connection
(
''
,
client_strategy
=
ldap
.
MOCK_SYNC
)
def
con
(
self
,
*
arg
):
return
self
.
conn
def
con_non
(
self
,
*
arg
):
return
self
.
conn_non
def
test_get_fsr_ldap
(
self
):
"""test the get_fsr_ldap function"""
ldap
.
Connection
=
self
.
con
...
...
@@ -50,7 +55,7 @@ class FsrLdapTest(unittest.TestCase):
def
test_get_protokollant_ldap
(
self
):
ldap
.
Connection
=
self
.
con
esme
.
current_user
=
lambda
:
'testing test1'
self
.
assertEqual
(
self
.
test_ldap_server
.
get_protokollant_ldap
({
'PROTOKOLL'
:
{
'Protokollant'
:
'testing test3'
}}),
'testing test1'
)
self
.
assertEqual
(
self
.
test_ldap_server
.
get_protokollant_ldap
({
'PROTOKOLL'
:
{
'Protokollant'
:
'testing test3'
}}),
'testing test1'
)
def
test_get_fsr_ldap_no_server
(
self
):
"""test the get_fsr_ldap function without ldap connection"""
...
...
@@ -67,7 +72,7 @@ class FsrLdapTest(unittest.TestCase):
def
test_get_protokollant_ldap_no_server
(
self
):
ldap
.
Connection
=
self
.
con_non
esme
.
current_user
=
lambda
:
'testing test1'
self
.
assertEqual
(
self
.
test_ldap_server
.
get_protokollant_ldap
({
'PROTOKOLL'
:
{
'Protokollant'
:
'testing test3'
}}),
'testing test3'
)
self
.
assertEqual
(
self
.
test_ldap_server
.
get_protokollant_ldap
({
'PROTOKOLL'
:
{
'Protokollant'
:
'testing test3'
}}),
'testing test3'
)
def
tearDown
(
self
):
"""cleanup after the tests"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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