From 94d3524d8644defc89eb02593ccd77414baa2670 Mon Sep 17 00:00:00 2001
From: Amita Sharma <amsharma@redhat.com>
Date: Mon, 27 Mar 2017 12:15:45 +0530
Subject: [PATCH] Issue - Modify token :assert: to :expectedresults:

Description - In order to import the test cases from source code to Polarion,
we are using betelgeuse and betelgeuse uses :expectedresults: token in place
of :assert: token. That needs a fix in create_test file and all other files
which used :assert: in docstrings

https://pagure.io/389-ds-base/issue/49156

Reviewed by: Simon Pichugin
---
 dirsrvtests/create_test.py                         |  2 +-
 dirsrvtests/tests/suites/config/config_test.py     |  6 ++--
 .../suites/filter/rfc3673_all_oper_attrs_test.py   |  4 +--
 .../suites/paged_results/paged_results_test.py     | 34 +++++++++++-----------
 .../suites/password/pwdPolicy_attribute_test.py    |  4 +--
 .../password/pwdPolicy_inherit_global_test.py      |  4 +--
 .../suites/password/pwdPolicy_warning_test.py      | 34 +++++++++++-----------
 dirsrvtests/tests/suites/plugins/accpol_test.py    |  6 ++--
 .../tests/suites/replication/acceptance_test.py    |  8 ++---
 .../tests/suites/replication/single_master_test.py |  4 +--
 .../tests/suites/replication/tombstone_test.py     |  2 +-
 dirsrvtests/tests/suites/setup_ds/setup_ds_test.py |  2 +-
 12 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index 0461ae0..ed71eaf 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -694,7 +694,7 @@ if len(sys.argv) > 0:
         TEST.write('    :setup: Fill in set up configuration here\n')
         TEST.write('    :steps: 1. Fill in test case steps here\n')
         TEST.write('            2. And indent them like this (RST format requirement)\n')
-        TEST.write('    :assert: Fill in the result that is expected\n')
+        TEST.write('    :expectedresults: Fill in the result that is expected\n')
         TEST.write('    """\n\n')
         TEST.write('    # If you need any test suite initialization,\n')
         TEST.write('    # please, write additional fixture for that (including finalizer).\n'
diff --git a/dirsrvtests/tests/suites/config/config_test.py b/dirsrvtests/tests/suites/config/config_test.py
index 1c67fcf..6170eb0 100644
--- a/dirsrvtests/tests/suites/config/config_test.py
+++ b/dirsrvtests/tests/suites/config/config_test.py
@@ -70,7 +70,7 @@ def test_maxbersize_repl(topology_m2, test_user, big_file):
     :steps: 1. Set 20KiB small maxbersize on master2
             2. Add big value to master2
             3. Add big value to master1
-    :assert: Adding the big value to master2 is failed,
+    :expectedresults: Adding the big value to master2 is failed,
              adding the big value to master1 is succeed,
              the big value is successfully replicated to master2
     """
@@ -144,7 +144,7 @@ def test_config_listen_backport_size(topology_m2):
                Try positive and negative.
             3. Set nsslapd-listen-backlog-size to an invalid value
             4. Set nsslapd-listen-backlog-size back to a default value
-    :assert: Search and the valid modification should be a success
+    :expectedresults: Search and the valid modification should be a success
              Modification with an invalid value should throw an error
     """
 
@@ -202,7 +202,7 @@ def test_config_deadlock_policy(topology_m2):
                Try positive and negative.
             3. Set nsslapd-db-deadlock-policy to an invalid value
             4. Set nsslapd-db-deadlock-policy back to a default value
-    :assert: Search and the valid modification should be a success
+    :expectedresults: Search and the valid modification should be a success
              Modification with invalid values should throw an error
     """
 
diff --git a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
index b9fcafc..83283dd 100644
--- a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
+++ b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
@@ -100,7 +100,7 @@ def test_supported_features(topology_st):
     :feature: Filter
     :setup: Standalone instance
     :steps: 1. Search for 'supportedFeatures' at rootDSE
-    :assert: Value 1.3.6.1.4.1.4203.1.5.1 is presented
+    :expectedresults: Value 1.3.6.1.4.1.4203.1.5.1 is presented
     """
 
     entries = topology_st.standalone.search_s('', ldap.SCOPE_BASE,
@@ -127,7 +127,7 @@ def test_search_basic(topology_st, test_user, user_aci, add_attr,
     :steps: 1. Bind as regular user or Directory Manager
             2. Search with '+' filter and with additionaly
                'objectClass' and '*' attrs too
-    :assert: All expected values were returned, not more
+    :expectedresults: All expected values were returned, not more
     """
 
     if regular_user:
diff --git a/dirsrvtests/tests/suites/paged_results/paged_results_test.py b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
index 96626aa..1f2098b 100644
--- a/dirsrvtests/tests/suites/paged_results/paged_results_test.py
+++ b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
@@ -253,7 +253,7 @@ def test_search_success(topology_st, test_user, page_size, users_num):
             variated number of users for the search base
     :steps: 1. Bind as test user
             2. Search through added users with a simple paged control
-    :assert: All users should be found
+    :expectedresults: All users should be found
     """
 
     users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
@@ -302,7 +302,7 @@ def test_search_limits_fail(topology_st, test_user, page_size, users_num,
             2. Set limit attribute to the value that will cause
                an expected exception
             3. Search through added users with a simple paged control
-    :assert: Should fail with appropriate exception
+    :expectedresults: Should fail with appropriate exception
     """
 
     users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX)
@@ -384,7 +384,7 @@ def test_search_sort_success(topology_st, test_user):
     :steps: 1. Bind as test user
             2. Search through added users with a simple paged control
                and a server side sort control
-    :assert: All users should be found and sorted
+    :expectedresults: All users should be found and sorted
     """
 
     users_num = 50
@@ -428,7 +428,7 @@ def test_search_abandon(topology_st, test_user):
     :steps: 1. Bind as test user
             2. Search through added users with a simple paged control
             3. Abandon the search
-    :assert: It will throw an ldap.TIMEOUT exception, while trying
+    :expectedresults: It will throw an ldap.TIMEOUT exception, while trying
              to get the rest of the search results
     """
 
@@ -478,7 +478,7 @@ def test_search_with_timelimit(topology_st, test_user):
                and timelimit set to 5
             3. When the returned cookie is empty, wait 10 seconds
             4. Perform steps 2 and 3 three times in a row
-    :assert: No error happens
+    :expectedresults: No error happens
     """
 
     users_num = 100
@@ -559,7 +559,7 @@ def test_search_dns_ip_aci(topology_st, test_user, aci_subject):
             6. Return ACI to the initial state
             7. Go through all steps onece again, but use IP subjectdn
                insted of DNS
-    :assert: No error happens, all users should be found and sorted
+    :expectedresults: No error happens, all users should be found and sorted
     """
 
     users_num = 100
@@ -627,7 +627,7 @@ def test_search_multiple_paging(topology_st, test_user):
             2. Initiate the search with a simple paged control
             3. Acquire the returned cookie only one time
             4. Perform steps 2 and 3 three times in a row
-    :assert: No error happens
+    :expectedresults: No error happens
     """
 
     users_num = 100
@@ -685,7 +685,7 @@ def test_search_invalid_cookie(topology_st, test_user, invalid_cookie):
             2. Initiate the search with a simple paged control
             3. Put an invalid cookie (-1, 1000) to the control
             4. Continue the search
-    :assert: It will throw an TypeError exception
+    :expectedresults: It will throw an TypeError exception
     """
 
     users_num = 100
@@ -735,7 +735,7 @@ def test_search_abandon_with_zero_size(topology_st, test_user):
     :steps: 1. Bind as test user
             2. Search through added users with a simple paged control
                and page_size = 0
-    :assert: No cookie should be returned at all
+    :expectedresults: No cookie should be returned at all
     """
 
     users_num = 10
@@ -783,7 +783,7 @@ def test_search_pagedsizelimit_success(topology_st, test_user):
             2. Bind as test user
             3. Search through added users with a simple paged control
                using page_size = 10
-    :assert: All users should be found
+    :expectedresults: All users should be found
     """
 
     users_num = 10
@@ -841,7 +841,7 @@ def test_search_nspagedsizelimit(topology_st, test_user,
             9. Bind as test user
             10. Search through added users with a simple paged control
                 using page_size = 10
-    :assert: After the steps 1-4, it should PASS.
+    :expectedresults: After the steps 1-4, it should PASS.
              After the steps 7-10, it should throw
              SIZELIMIT_EXCEEDED exception
     """
@@ -909,7 +909,7 @@ def test_search_paged_limits(topology_st, test_user, conf_attr_values, expected_
             9. Bind as test user
             10. Search through added users with a simple paged control
                 using page_size = 10
-    :assert: After the steps 1-4, it should PASS.
+    :expectedresults: After the steps 1-4, it should PASS.
              After the steps 7-10, it should throw
              ADMINLIMIT_EXCEEDED exception
     """
@@ -985,7 +985,7 @@ def test_search_paged_user_limits(topology_st, test_user, conf_attr_values, expe
             10. Bind as test user
             11. Search through added users with a simple paged control
                 using page_size = 10
-    :assert: After the steps 1-4, it should PASS.
+    :expectedresults: After the steps 1-4, it should PASS.
              After the steps 8-11, it should throw
              ADMINLIMIT_EXCEEDED exception
     """
@@ -1047,7 +1047,7 @@ def test_ger_basic(topology_st, test_user):
             variated number of users for the search base
     :steps: 1. Search through added users with a simple paged control
                and get effective rights control
-    :assert: All users should be found, every found entry should have
+    :expectedresults: All users should be found, every found entry should have
              an 'attributeLevelRights' returned
     """
 
@@ -1089,7 +1089,7 @@ def test_multi_suffix_search(topology_st, test_user, new_suffixes):
                using page_size = 4
             3. Wait some time logs to be updated
             3. Check access log
-    :assert: All users should be found, the access log should contain
+    :expectedresults: All users should be found, the access log should contain
              the pr_cookie for each page request and it should be equal 0,
              except the last one should be equal -1
     """
@@ -1145,7 +1145,7 @@ def test_maxsimplepaged_per_conn_success(topology_st, test_user, conf_attr_value
                to the next values: no value, -1, some positive
             2. Search through the added users with a simple paged control
                using page size = 4
-    :assert: If no value or value = -1 - all users should be found,
+    :expectedresults: If no value or value = -1 - all users should be found,
              default behaviour;
              If the value is positive, the value is the max simple paged
              results requests per connection.
@@ -1194,7 +1194,7 @@ def test_maxsimplepaged_per_conn_failure(topology_st, test_user, conf_attr_value
             3. Set nsslapd-maxsimplepaged-per-conn = 1 in cn=config
             4. Search through the added users with a simple paged control
                using page size = 4 two times, but don't close the connections
-    :assert: During the searches UNWILLING_TO_PERFORM should be throwned
+    :expectedresults: During the searches UNWILLING_TO_PERFORM should be throwned
     """
 
     users_list = add_users(topology_st, 20, DEFAULT_SUFFIX)
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py b/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py
index d076cf4..4584f29 100644
--- a/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_attribute_test.py
@@ -132,7 +132,7 @@ def test_change_pwd(topology_st, test_user, password_policy,
             2. Bind as test user
             3. Try to change password
 
-    :assert: Subtree/User passwordChange - result
+    :expectedresults: Subtree/User passwordChange - result
              off/on, on/on - success
              on/off, off/off - UNWILLING_TO_PERFORM
     """
@@ -202,7 +202,7 @@ def test_pwd_min_age(topology_st, test_user, password_policy):
             5. Try to change password two times in a row
             6. Wait 12 seconds
             7. Try to change password
-    :assert: User should be not allowed to change the password
+    :expectedresults: User should be not allowed to change the password
              right after previous change - CONSTRAINT_VIOLATION
              User should be not allowed to change the password
              after 12 seconds passed
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py b/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py
index fddbd49..828a2d3 100644
--- a/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_inherit_global_test.py
@@ -157,7 +157,7 @@ def test_entry_has_no_restrictions(topology_st, password_policy, test_user,
                b) 'on' and 'off'
                c) 'off' and 'on'
             3. Try to add user with a short password
-    :assert: No exception should occure
+    :expectedresults: No exception should occure
     """
 
     log.info('Set {} to {}'.format(ATTR_INHERIT_GLOBAL, inherit_value))
@@ -220,7 +220,7 @@ def test_entry_has_restrictions(topology_st, password_policy, test_user, contain
                b) ou=people policy container
             5. Try to add user with a short password (<9)
             6. Try to add user with a long password (>9)
-    :assert: User should be rejected
+    :expectedresults: User should be rejected
     """
 
     log.info('Set {} to {}'.format(ATTR_INHERIT_GLOBAL, 'on'))
diff --git a/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py b/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
index bc7175a..9c583d9 100644
--- a/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
+++ b/dirsrvtests/tests/suites/password/pwdPolicy_warning_test.py
@@ -240,9 +240,9 @@ def test_different_values(topology_st, value):
                under cn=config entry
             2. Run the search command to check the
                value of passwordSendExpiringTime attribute
-    :assert: 1. Invalid values should be rejected with
-                an OPERATIONS_ERROR
-             2. Valid values should be accepted and saved
+    :expectedresults: 1. Invalid values should be rejected with
+                      an OPERATIONS_ERROR
+                      2. Valid values should be accepted and saved
     """
 
     log.info('Get the default value')
@@ -285,8 +285,8 @@ def test_expiry_time(topology_st, global_policy, add_user):
             2. User entry for binding
     :steps: 1. Bind as the user
             2. Request the control for the user
-    :assert: The password expiry warning time for the user should be
-             returned
+    :expectedresults: The password expiry warning time for the user should be
+                      returned
     """
 
     res_ctrls = None
@@ -328,8 +328,8 @@ def test_password_warning(topology_st, global_policy, add_user, attr, val):
             2. Bind as the user
             3a. Request the control for the user
             3b. Request the password expiry warning time
-    :assert: a. Password expiry warning time should not be returned
-             b. Password expiry warning time should be returned
+    :expectedresults: a. Password expiry warning time should not be returned
+                      b. Password expiry warning time should be returned
     """
 
     try:
@@ -370,11 +370,11 @@ def test_with_different_password_states(topology_st, global_policy, add_user):
             3. Set the system date to the current day
             4. Try to bind with the user entry and request
                the control
-    :assert: 1. In the first try, the bind should fail with an
-                INVALID_CREDENTIALS error
-             2. In the second try, the bind should be successful
-                and the password expiry warning time should be
-                returned
+    :expectedresults: 1. In the first try, the bind should fail with an
+                        INVALID_CREDENTIALS error
+                      2. In the second try, the bind should be successful
+                        and the password expiry warning time should be
+                        returned
     """
 
     res_ctrls = None
@@ -428,9 +428,9 @@ def test_default_behavior(topology_st, global_policy_default, add_user):
             2. User entry for binding to the server
     :steps: 1. Bind as the user
             2. Request the control for the user
-    :assert: Password expiry warning time should be returned by the
-             server by the server since passwordMaxAge and
-             passwordWarning are set to the same value
+    :expectedresults: Password expiry warning time should be returned by the
+                      server by the server since passwordMaxAge and
+                      passwordWarning are set to the same value
     """
 
     res_ctrls = None
@@ -469,8 +469,8 @@ def test_with_local_policy(topology_st, global_policy, local_policy):
                -h localhost -p 389 -U 'uid=tuser,dc=example,dc=com'
     :steps: 1. Bind as the user
             2. Request the control for the user
-    :assert: Password expiry warning time should not be returned for the
-             user
+    :expectedresults: Password expiry warning time should not be returned for the
+                      user
     """
 
     res_ctrls = None
diff --git a/dirsrvtests/tests/suites/plugins/accpol_test.py b/dirsrvtests/tests/suites/plugins/accpol_test.py
index 1dbf505..595ea27 100644
--- a/dirsrvtests/tests/suites/plugins/accpol_test.py
+++ b/dirsrvtests/tests/suites/plugins/accpol_test.py
@@ -126,7 +126,7 @@ def test_actNinact_local(topology_st, accpolicy_local):
             5. Wait for 2 secs or till accountInactivityLimit is exceeded
             6. Run ldapsearch as normal user and check if its inactivated, expected error 19.
             7. Sleep for +14 secs to check if accounts accessed at step4 are inactivated now
-    :assert: Should return error code 19
+    :expectedresults: Should return error code 19
     """
 
     suffix = DEFAULT_SUFFIX
@@ -160,7 +160,7 @@ def test_noinact_local(topology_st, accpolicy_local):
             2. Wait for 16 secs and run ldapsearch as normal user to check account is active, expected 0.
             3. Move users from ou=groups to ou=people subtree
             4. Sleep for 16 secs and check if entries are inactivated
-    :assert: Should return error code 0 and 19
+    :expectedresults: Should return error code 0 and 19
     """
 
     suffix = DEFAULT_SUFFIX
@@ -200,7 +200,7 @@ def test_inact_local(topology_st, accpolicy_local):
             3. Move users from ou=people to ou=groups subtree
             4. Sleep for +2 secs and check if users are inactivated in ou=people subtree
             5. Check if users are not inactivated in ou=groups subtree
-    :assert: Should return error code 0
+    :expectedresults: Should return error code 0
     """
 
     suffix = DEFAULT_SUFFIX
diff --git a/dirsrvtests/tests/suites/replication/acceptance_test.py b/dirsrvtests/tests/suites/replication/acceptance_test.py
index 5b785f3..e677b9d 100644
--- a/dirsrvtests/tests/suites/replication/acceptance_test.py
+++ b/dirsrvtests/tests/suites/replication/acceptance_test.py
@@ -76,7 +76,7 @@ def test_add_entry(topo, test_entry):
     :steps: 1. Add entry to master1
             2. Wait for replication to happen
             3. Check entry on all other masters
-    :assert: Entry should be replicated
+    :expectedresults: Entry should be replicated
     """
 
     entries = get_repl_entries(topo, TEST_ENTRY_NAME, ["uid"])
@@ -92,7 +92,7 @@ def test_modify_entry(topo, test_entry):
     :steps: 1. Modify the entry on master1 (try add, modify and delete operations)
             2. Wait for replication to happen
             3. Check entry on all other masters
-    :assert: Entry attr should be replicated
+    :expectedresults: Entry attr should be replicated
     """
 
     log.info('Modifying entry {} - add operation'.format(TEST_ENTRY_DN))
@@ -144,7 +144,7 @@ def test_delete_entry(topo, test_entry):
     :steps: 1. Delete the entry from master1
             2. Wait for replication to happen
             3. Check entry on all other masters
-    :assert: Entry deletion should be replicated
+    :expectedresults: Entry deletion should be replicated
     """
 
     log.info('Deleting entry {} during the test'.format(TEST_ENTRY_DN))
@@ -164,7 +164,7 @@ def test_modrdn_entry(topo, test_entry, delold):
     :steps: 1. Make modrdn operation on entry on master1 with both delold 1 and 0
             2. Wait for replication to happen
             3. Check entry on all other masters
-    :assert: Entry with new RDN should be replicated.
+    :expectedresults: Entry with new RDN should be replicated.
              If delold was specified, entry with old RDN shouldn't exist
     """
 
diff --git a/dirsrvtests/tests/suites/replication/single_master_test.py b/dirsrvtests/tests/suites/replication/single_master_test.py
index 8be6d37..c1428f6 100644
--- a/dirsrvtests/tests/suites/replication/single_master_test.py
+++ b/dirsrvtests/tests/suites/replication/single_master_test.py
@@ -85,7 +85,7 @@ def test_mail_attr_repl(topo_r, test_user):
             4. Restore mail database
             5. Search for the entry with a substring 'mail=user*'
             6. Search for the entry once again to make sure that server is alive
-    :assert: No crash happens
+    :expectedresults: No crash happens
     """
 
     master = topo_r.ms["master1"]
@@ -144,7 +144,7 @@ def test_lastupdate_attr_before_init(topo_nr, replica_without_init):
             without initialization
     :steps: 1. Check nsds5replicaLastUpdateStart, nsds5replicaLastUpdateEnd,
                nsds5replicaLastUpdateStatus attrs
-    :assert: nsds5replicaLastUpdateStart: 0, nsds5replicaLastUpdateEnd: 0 and
+    :expectedresults: nsds5replicaLastUpdateStart: 0, nsds5replicaLastUpdateEnd: 0 and
              nsds5replicaLastUpdateStatus is not equal to
              "0 Replica acquired successfully: Incremental update started"
     """
diff --git a/dirsrvtests/tests/suites/replication/tombstone_test.py b/dirsrvtests/tests/suites/replication/tombstone_test.py
index 4c623ba..71fc084 100644
--- a/dirsrvtests/tests/suites/replication/tombstone_test.py
+++ b/dirsrvtests/tests/suites/replication/tombstone_test.py
@@ -22,7 +22,7 @@ def test_purge_success(topology_st):
             2. Add an entry to the replicated suffix
             3. Delete the entry
             4. Check that tombstone entry exists (objectclass=nsTombstone)
-    :assert: Tombstone entry exist
+    :expectedresults: Tombstone entry exist
     """
 
     log.info('Setting up replication...')
diff --git a/dirsrvtests/tests/suites/setup_ds/setup_ds_test.py b/dirsrvtests/tests/suites/setup_ds/setup_ds_test.py
index db2dff1..5fa2fbb 100644
--- a/dirsrvtests/tests/suites/setup_ds/setup_ds_test.py
+++ b/dirsrvtests/tests/suites/setup_ds/setup_ds_test.py
@@ -47,7 +47,7 @@ def test_slapd_InstScriptsEnabled(config_attr):
             2. Check if /usr/lib64/dirsrv/slapd-instance instance script directory is created or not.
             3. The script directory should be created if slapd.InstScriptsEnabled option is "True"
             4. The script directory should not be created if slapd.InstScriptsEnabled option is "False"
-    :assert: The script directory should be created if slapd.InstScriptsEnabled option is "True" and not if it is "Fasle"
+    :expectedresults: The script directory should be created if slapd.InstScriptsEnabled option is "True" and not if it is "Fasle"
     """
 
     log.info('set SER_INST_SCRIPTS_ENABLED to {}'.format(config_attr))
-- 
2.5.5

