summaryrefslogtreecommitdiff
path: root/source4/dsdb/tests/python/linked_attributes.py
AgeCommit message (Collapse)AuthorFilesLines
2023-03-23s4:dsdb/tests: let a test to demonstrate the behavior of invisible backlinksStefan Metzmacher1-0/+100
msDS-KeyCredentialLink/msDS-KeyCredentialLink-BL are defined as linked attribute pair, but msDS-KeyCredentialLink-BL is not defined as allowed on any object class definition, still it's possible to create msDS-KeyCredentialLink attributes. msDS-KeyPrincipal/msDS-KeyPrincipalBL are also defined as linked attribute pair and msDS-KeyPrincipalBL is only allowed on object class 'user', but it's possible to create msDS-KeyPrincipal values pointing to non 'user' objects. The result is that 'user' objects have a visible msDS-KeyPrincipalBL, but the others don't have msDS-KeyPrincipalBL visible, by default. The backlinks are always visible if the backlink attributes are explicitly requested. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12967 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-03-23s4:dsdb/tests: let linked_attributes.py use a container as testbaseStefan Metzmacher1-7/+7
The tests don't require an organizationalUnit as parent object and it makes it possible to create msDS-KeyCredential objects within the container in the next step. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12967 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-02-23selftest: source4: fix mutable default argumentsRob van der Linde1-2/+7
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2021-10-04selftest: Move self.assertRaisesLdbError() to samba.tests.TestCaseAndrew Bartlett1-21/+0
This is easier to reason with regarding which cases should work and which cases should fail, avoiding issues where more success than expected would be OK because a self.fail() was missed in a try: block. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-04-28python: remove all 'from __future__ import print_function'Douglas Bagnall1-1/+0
This made Python 2's print behave like Python 3's print(). In some cases, where we had: from __future__ import print_function """Intended module documentation...""" this will have the side effect of making the intended module documentation work as the actual module documentation (i.e. becoming __doc__), because it is once again the first statement in the module. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-03-22dsdb: Add test for the case of a link pointing back at its own objectAndrew Bartlett1-0/+25
This type of object was not possible to delete in Samba without first removing the link. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14306 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2018-12-14PY3: change shebang to python3 in source4/dsdb dirJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2018-12-10s4/dsdb/tests/python: PY3 port for samba4.ldap.linked_attributesNoel Power1-1/+1
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-08-24PEP8: fix E305: expected 2 blank lines after class or function definition, ↵Joe Guo1-0/+1
found 1 Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E303: too many blank lines (2)Joe Guo1-1/+0
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E231: missing whitespace after ','Joe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E124: closing bracket does not match visual indentationJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-04-13python: bulk replace dict.iteritems to items for py3Joe Guo1-2/+2
In py3, iterxxx methods are removed. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-03-23s3/dsdb: convert print func to be py2/py3 compatibleNoel Power1-7/+8
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-02-28dsdb python tests: convert 'except X, (tuple)' to 'except X as e'Noel Power1-1/+2
In addition to converting the except line another line is also added for each except to extract the tuple contents. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-02-15dsdb python tests: convert 'except X, e' to 'except X as e'Douglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-10-26linked attribute tests: correct add_all_at_once testDouglas Bagnall1-8/+5
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Oct 26 05:36:11 CEST 2017 on sn-devel-144
2017-10-26linked_attribute tests: helper assert function for expected LdbErrorDouglas Bagnall1-20/+29
The logic involved in asserting that a function raises an LdbError with a particular error value has shown itself to be too complicated for me to repeat too often. To test this function, you would want a put a test in a bit like this: def test_assertRaisesLdbError(self): for i in [1, 2, ldb.ERR_ENTRY_ALREADY_EXISTS, 999]: def f(*args, **kwargs): raise ldb.LdbError(i, 'msg %s' % i) self.assertRaisesLdbError(i, 'a message', f, 'la la', la='la') def f2(*args, **kwargs): raise ldb.LdbError(i + 1, 'msg %s' % i) def f3(*args, **kwargs): pass for f in (f2, f3): try: self.assertRaisesLdbError(i, 'a message', f, 'la la', la='la') except AssertionError as e: print i, e, f pass else: print i, f self.fail('assertRaisesLdbError() failed to fail!') ..but a self-testing test-tester is getting a too meta to run in every autobuild. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-10-26linked attribute tests: fix logic for add testDouglas Bagnall1-0/+2
We were ensuring that when we got an LdbError it was the right type, but we weren't ensuring we got one at all. The new test doesn't fail. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-10-26linked attribute tests: ensure duplicate deletes failDouglas Bagnall1-0/+5
We can't remove the same thing twice in the same message. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-10-26linked attribute tests: test against duplicates in replaceDouglas Bagnall1-0/+10
We should not be able to introduce duplicate links using MOD_REPLACE. It turns out we could and weren't testing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13095 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-06-15s4/linked_attribute tests: test duplicate valuesDouglas Bagnall1-1/+19
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-09s4/linked_attribute tests: remove helper function unused parameterDouglas Bagnall1-3/+2
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-09s4/linked_attribute tests: try adding linked attributes directlyDouglas Bagnall1-13/+51
Previously we have only added linked attributes using a modify. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Pair-programmed-with: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-09s4/linked_attribute tests: test with the relax controlDouglas Bagnall1-6/+75
We had a theory this caused problems. It didn't, but the tests are still worthwhile. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-09s4/linked_attribute tests: compare link lists in sorted orderDouglas Bagnall1-5/+3
This isn't functionally different[1] from the previous use of set(), but it makes the error output easier to read. [1] OK, it will also show duplicates, which we really don't expect and would definitely want to see. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-09s4/linked_attribute tests: remove unused codeDouglas Bagnall1-22/+0
We don't test for sort order because we don't depend on it. So this test was never used. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-09s4/linked_attribute tests: add multiple links and replace testsDouglas Bagnall1-0/+132
Also a "delete all" test. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-02-09s4/linked_attributes test: pep8 tidy-up, remove unused importsDouglas Bagnall1-10/+7
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-09-08tests: Skip a test for reveal internals for passing WindowsGarming Sam1-1/+6
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-09-08tests: Check that USN bumps when modifying a linked attrGarming Sam1-0/+21
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-09-08tests: Assert vanishing links doesn't bump USNGarming Sam1-0/+20
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-07-15link_attrs: Add tests for one way links (and pseudo one-way)Garming Sam1-0/+68
Tested against Win2012R2. The deactivated link control has no effect on either one way links or pseudo ones (only two-way ones presumably). Signed-off-by: Garming Sam <garming@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-07-15dsdb tests: add linked attribute testsDouglas Bagnall1-0/+363
Note that this test will not work properly across ldap as the marked-deleted linked attributes will not appear. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>