Debian Codegraph @

dirsrvtests/tests/suites/openldap_2_389/migrate_memberof_test.py

raw
1 # --- BEGIN COPYRIGHT BLOCK ---
2 # Copyright (C) 2022 William Brown <[email protected]>
3 # All rights reserved.
4 #
5 # License: GPL (version 3 or any later version).
6 # See LICENSE for details.
7 # --- END COPYRIGHT BLOCK ---
8 #
9 import pytest
10 import os
11 from test389.topologies import topology_st
12 from lib389.utils import ds_is_older
13 from lib389.migrate.openldap.config import olConfig
14 from lib389.migrate.openldap.config import olOverlayType
15 from lib389.migrate.plan import Migration
16 from lib389.plugins import MemberOfPlugin
17
18 pytestmark = pytest.mark.tier1
19
20 DATADIR1 = os.path.join(os.path.dirname(__file__), '../../data/openldap_2_389/memberof/')
21
22 @pytest.mark.skipif(ds_is_older('1.4.3'), reason="Not implemented")
23 def test_migrate_openldap_memberof(topology_st):
24 """Attempt a migration with memberof configured, and ensure it migrates
25
26 :id: f59f4c6a-7c85-40d1-91ee-dccbc0bd7ef8
27 :setup: Data directory with an openldap config with memberof
28 :steps:
29 1. Parse the configuration
30 2. Execute a full migration plan
31 3. Assert memberof was configured
32
33 :expectedresults:
34 1. Success
35 2. Success
36 3. Success
37 """
38
39 inst = topology_st.standalone
40 config_path = os.path.join(DATADIR1, 'slapd.d')
41 config = olConfig(config_path)
42
43 for overlay in config.databases[0].overlays:
44 print("==================================================")
45 print("%s" % overlay.otype)
46 print("==================================================")
47 assert overlay.otype != olOverlayType.UNKNOWN
48
49 ldifs = {}
50
51 migration = Migration(inst, config.schema, config.databases, ldifs)
52
53 print("==== migration plan ====")
54 print(migration.__unicode__())
55 print("==== end migration plan ====")
56
57 migration.execute_plan()
58 # End test, should suceed with no exceptions.
59
60 memberof = MemberOfPlugin(inst)
61 assert memberof.status()
62
63