summaryrefslogtreecommitdiff
path: root/test/testTransactions.py
diff options
context:
space:
mode:
authorAndrej Shadura <andrew.shadura@collabora.co.uk>2020-11-30 12:16:10 +0100
committerAndrej Shadura <andrew.shadura@collabora.co.uk>2020-11-30 12:16:10 +0100
commitd7ea1d4c872a0ef39cce7a6bb6d2b9c9fd6c205e (patch)
tree509fcc27647de80e229c24babd4685ba04b45802 /test/testTransactions.py
parent2bcee5c91d65796532aef1b15f6c8c0c16197aee (diff)
parent96fb2df0e33b34a4dbb75577de8589a8611759c4 (diff)
Update upstream source from tag 'upstream/2.8.1'
Update to upstream version '2.8.1' with Debian dir 4d1ac29b7ae225ca99fb367a07e2e8183bc94036
Diffstat (limited to 'test/testTransactions.py')
-rw-r--r--test/testTransactions.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/test/testTransactions.py b/test/testTransactions.py
index 0f7917d..9707e79 100644
--- a/test/testTransactions.py
+++ b/test/testTransactions.py
@@ -29,7 +29,7 @@ import unittest
from ldap3 import MODIFY_REPLACE
from ldap3.protocol.controls import build_control
from ldap3.protocol.novell import Integer
-from test.config import add_user, get_connection, drop_connection, random_id, test_server_type
+from test.config import add_user, get_connection, drop_connection, random_id, test_server_type, get_response_values
testcase_id = ''
@@ -51,12 +51,8 @@ class Test(unittest.TestCase):
transaction_control = self.connection.extend.novell.start_transaction()
self.connection.modify(self.delete_at_teardown[0][0], {'givenName': (MODIFY_REPLACE, ['user-1b'])}, controls=[transaction_control])
self.connection.modify(self.delete_at_teardown[0][0], {'sn': (MODIFY_REPLACE, ['sn-user-1b'])}, controls=[transaction_control])
- result = self.connection.extend.novell.end_transaction(commit=True, controls=[transaction_control])
- result = self.connection.search(self.delete_at_teardown[0][0], '(objectclass=*)', attributes=['givenName', 'sn'])
- if not self.connection.strategy.sync:
- response, result = self.connection.get_response(result)
- else:
- response, result = self.connection.response, self.connection.result
+ self.connection.extend.novell.end_transaction(commit=True, controls=[transaction_control])
+ status, result, response, request = get_response_values(self.connection.search(self.delete_at_teardown[0][0], '(objectclass=*)', attributes=['givenName', 'sn']), self.connection)
if response:
self.assertEqual(response[0]['attributes']['givenName'][0], 'user-1b')
@@ -70,13 +66,8 @@ class Test(unittest.TestCase):
transaction_control = self.connection.extend.novell.start_transaction()
self.connection.modify(self.delete_at_teardown[0][0], {'givenName': (MODIFY_REPLACE, ['user-1b'])}, controls=[transaction_control])
self.connection.modify(self.delete_at_teardown[0][0], {'sn': (MODIFY_REPLACE, ['sn-user-1b'])}, controls=[transaction_control])
- result = self.connection.extend.novell.end_transaction(commit=False, controls=[transaction_control])
- result = self.connection.search(self.delete_at_teardown[0][0], '(objectclass=*)', attributes=['givenName', 'sn'])
- if not self.connection.strategy.sync:
- response, result = self.connection.get_response(result)
- else:
- response, result = self.connection.response, self.connection.result
-
+ self.connection.extend.novell.end_transaction(commit=False, controls=[transaction_control])
+ status, result, response, request = get_response_values(self.connection.search(self.delete_at_teardown[0][0], '(objectclass=*)', attributes=['givenName', 'sn']), self.connection)
if response:
# self.assertEqual(response[0]['attributes']['givenName'][0], 'user-1b')
self.assertEqual(response[0]['attributes']['sn'][0], 'user-1')
@@ -90,13 +81,8 @@ class Test(unittest.TestCase):
invalid_transaction_control = build_control('2.16.840.1.113719.1.27.103.7', True, Integer(12345678), encode_control_value=True)
self.connection.modify(self.delete_at_teardown[0][0], {'givenName': (MODIFY_REPLACE, ['user-1b'])}, controls=[transaction_control])
self.connection.modify(self.delete_at_teardown[0][0], {'sn': (MODIFY_REPLACE, ['sn-user-1b'])}, controls=[invalid_transaction_control])
- result = self.connection.extend.novell.end_transaction(commit=True, controls=[transaction_control])
- result = self.connection.search(self.delete_at_teardown[0][0], '(objectclass=*)', attributes=['givenName', 'sn'])
- if not self.connection.strategy.sync:
- response, result = self.connection.get_response(result)
- else:
- response, result = self.connection.response, self.connection.result
-
+ self.connection.extend.novell.end_transaction(commit=True, controls=[transaction_control])
+ status, result, response, request = get_response_values(self.connection.search(self.delete_at_teardown[0][0], '(objectclass=*)', attributes=['givenName', 'sn']), self.connection)
if response:
self.assertEqual(response[0]['attributes']['givenName'][0], 'user-1b')
self.assertEqual(response[0]['attributes']['sn'][0], 'user-1')