mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-30 20:48:23 +01:00
Merge pull request #13191 from danfengliu/add-ui-test-for-ldap-group-dn-setting
Add UI test for LDAP admin group dn setting
This commit is contained in:
commit
6ea67b317f
@ -21,6 +21,8 @@ def set_configurations(client, expect_status_code = 200, expect_response_body =
|
|||||||
conf.ldap_group_search_filter = config.get("ldap_group_search_filter")
|
conf.ldap_group_search_filter = config.get("ldap_group_search_filter")
|
||||||
if "ldap_group_search_scope" in config:
|
if "ldap_group_search_scope" in config:
|
||||||
conf.ldap_group_search_scope = config.get("ldap_group_search_scope")
|
conf.ldap_group_search_scope = config.get("ldap_group_search_scope")
|
||||||
|
if "ldap_group_admin_dn" in config:
|
||||||
|
conf.ldap_group_admin_dn = config.get("ldap_group_admin_dn")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_, status_code, _ = client.configurations_put_with_http_info(conf)
|
_, status_code, _ = client.configurations_put_with_http_info(conf)
|
||||||
@ -68,9 +70,9 @@ class Configurations(base.Base):
|
|||||||
set_configurations(client, expect_status_code = expect_status_code, **config)
|
set_configurations(client, expect_status_code = expect_status_code, **config)
|
||||||
|
|
||||||
def set_configurations_of_ldap(self, ldap_filter=None, ldap_group_attribute_name=None,
|
def set_configurations_of_ldap(self, ldap_filter=None, ldap_group_attribute_name=None,
|
||||||
ldap_group_base_dn=None, ldap_group_search_filter=None, ldap_group_search_scope=None, expect_status_code = 200, **kwargs):
|
ldap_group_base_dn=None, ldap_group_search_filter=None, ldap_group_search_scope=None, ldap_group_admin_dn=None, expect_status_code = 200, **kwargs):
|
||||||
client = self._get_client(**kwargs)
|
client = self._get_client(**kwargs)
|
||||||
config=dict(ldap_filter=ldap_filter, ldap_group_attribute_name=ldap_group_attribute_name,
|
config=dict(ldap_filter=ldap_filter, ldap_group_attribute_name=ldap_group_attribute_name,
|
||||||
ldap_group_base_dn=ldap_group_base_dn, ldap_group_search_filter=ldap_group_search_filter, ldap_group_search_scope=ldap_group_search_scope)
|
ldap_group_base_dn=ldap_group_base_dn, ldap_group_search_filter=ldap_group_search_filter, ldap_group_admin_dn=ldap_group_admin_dn, ldap_group_search_scope=ldap_group_search_scope)
|
||||||
set_configurations(client, expect_status_code = expect_status_code, **config)
|
set_configurations(client, expect_status_code = expect_status_code, **config)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class TestLdapAdminRole(unittest.TestCase):
|
|||||||
1. Set LDAP Auth configurations;
|
1. Set LDAP Auth configurations;
|
||||||
2. Create a new public project(PA) by LDAP user mike;
|
2. Create a new public project(PA) by LDAP user mike;
|
||||||
3. Check project is created successfully;
|
3. Check project is created successfully;
|
||||||
4. Check mike is not admin;
|
4. Check mike's SysAdminFlag is false, but AdminRoleInAuth should be true
|
||||||
5. Delete project(PA);
|
5. Delete project(PA);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -41,8 +41,10 @@ class TestLdapAdminRole(unittest.TestCase):
|
|||||||
TestLdapAdminRole.project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_MIKE)
|
TestLdapAdminRole.project_id, project_name = self.project.create_project(metadata = {"public": "false"}, **self.USER_MIKE)
|
||||||
self.project.check_project_name_exist(name=project_name, **self.USER_MIKE)
|
self.project.check_project_name_exist(name=project_name, **self.USER_MIKE)
|
||||||
|
|
||||||
_user = self.user.get_user_by_name(self.USER_MIKE["username"], **ADMIN_CLIENT)
|
_user = self.user.get_user_current(**self.USER_MIKE)
|
||||||
|
print( _user)
|
||||||
self.assertFalse(_user.sysadmin_flag)
|
self.assertFalse(_user.sysadmin_flag)
|
||||||
|
self.assertTrue(_user.admin_role_in_auth)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -410,7 +410,7 @@ Edit A Distribution
|
|||||||
[Arguments] ${name} ${endpoint} ${new_endpoint}=${null}
|
[Arguments] ${name} ${endpoint} ${new_endpoint}=${null}
|
||||||
Switch To Distribution
|
Switch To Distribution
|
||||||
Filter Distribution List ${name} ${endpoint}
|
Filter Distribution List ${name} ${endpoint}
|
||||||
Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label
|
Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label times=9
|
||||||
Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_edit_btn_id}
|
Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_edit_btn_id}
|
||||||
Retry Double Keywords When Error Retry Element Click ${distribution_edit_btn_id} Wait Until Element Is Visible And Enabled ${distribution_name_input_id}
|
Retry Double Keywords When Error Retry Element Click ${distribution_edit_btn_id} Wait Until Element Is Visible And Enabled ${distribution_name_input_id}
|
||||||
Retry Text Input ${distribution_endpoint_id} ${new_endpoint}
|
Retry Text Input ${distribution_endpoint_id} ${new_endpoint}
|
||||||
|
@ -42,6 +42,9 @@ ${checkbox_delete_untagged_artifacts} //gc-config//clr-toggle-wrapper/label[con
|
|||||||
${cfg_auth_automatic_onboarding_checkbox} //clr-checkbox-wrapper//label[contains(@for,'oidcAutoOnboard')]
|
${cfg_auth_automatic_onboarding_checkbox} //clr-checkbox-wrapper//label[contains(@for,'oidcAutoOnboard')]
|
||||||
${cfg_auth_user_name_claim_input} //*[@id='oidcUserClaim']
|
${cfg_auth_user_name_claim_input} //*[@id='oidcUserClaim']
|
||||||
|
|
||||||
|
${cfg_auth_ldap_group_admin_dn} //*[@id='ldapGroupAdminDN']
|
||||||
|
|
||||||
|
|
||||||
${distribution_add_btn_id} //*[@id='new-instance']
|
${distribution_add_btn_id} //*[@id='new-instance']
|
||||||
${distribution_provider_select_id} //*[@id='provider']
|
${distribution_provider_select_id} //*[@id='provider']
|
||||||
${distribution_name_input_id} //*[@id='name']
|
${distribution_name_input_id} //*[@id='name']
|
||||||
|
@ -19,6 +19,16 @@ Resource ../../resources/Util.robot
|
|||||||
*** Variables ***
|
*** Variables ***
|
||||||
|
|
||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
|
Switch To Configuration Authentication
|
||||||
|
Sleep 1
|
||||||
|
Retry Element Click xpath=${configuration_xpath}
|
||||||
|
Retry Element Click xpath=${configuration_authentication_tabsheet_id}
|
||||||
|
|
||||||
|
Set LDAP Group Admin DN
|
||||||
|
[Arguments] ${group_dn}
|
||||||
|
Switch To Configuration Authentication
|
||||||
|
Retry Text Input ${cfg_auth_ldap_group_admin_dn} ${group_dn}
|
||||||
|
Retry Element Click ${config_auth_save_button_xpath}
|
||||||
|
|
||||||
Ldap User Should Not See Change Password
|
Ldap User Should Not See Change Password
|
||||||
Retry Element Click //clr-header//clr-dropdown[2]//button
|
Retry Element Click //clr-header//clr-dropdown[2]//button
|
||||||
|
@ -10,10 +10,13 @@ Default Tags API
|
|||||||
|
|
||||||
*** Test Cases ***
|
*** Test Cases ***
|
||||||
Test Case - LDAP Group Admin Role
|
Test Case - LDAP Group Admin Role
|
||||||
|
[Tags] group_admin
|
||||||
Harbor API Test ./tests/apitests/python/test_ldap_admin_role.py
|
Harbor API Test ./tests/apitests/python/test_ldap_admin_role.py
|
||||||
|
|
||||||
Test Case - LDAP Group User Group
|
Test Case - LDAP Group User Group
|
||||||
|
[Tags] group_user
|
||||||
Harbor API Test ./tests/apitests/python/test_user_group.py
|
Harbor API Test ./tests/apitests/python/test_user_group.py
|
||||||
|
|
||||||
Test Case - Run LDAP Group Related API Test
|
Test Case - Run LDAP Group Related API Test
|
||||||
|
[Tags] assign_role
|
||||||
Harbor API Test ./tests/apitests/python/test_assign_role_to_ldap_group.py
|
Harbor API Test ./tests/apitests/python/test_assign_role_to_ldap_group.py
|
@ -723,7 +723,7 @@ Test Case - Proxy Cache
|
|||||||
Test Case - Distribution CRUD
|
Test Case - Distribution CRUD
|
||||||
${d}= Get Current Date result_format=%m%s
|
${d}= Get Current Date result_format=%m%s
|
||||||
${name}= Set Variable distribution${d}
|
${name}= Set Variable distribution${d}
|
||||||
${endpoint}= Set Variable https://1.1.1.2
|
${endpoint}= Set Variable https://32.1.1.2
|
||||||
${endpoint_new}= Set Variable https://10.65.65.42
|
${endpoint_new}= Set Variable https://10.65.65.42
|
||||||
Init Chrome Driver
|
Init Chrome Driver
|
||||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||||
@ -732,11 +732,11 @@ Test Case - Distribution CRUD
|
|||||||
Delete A Distribution ${name} ${endpoint_new}
|
Delete A Distribution ${name} ${endpoint_new}
|
||||||
Close Browser
|
Close Browser
|
||||||
|
|
||||||
Test Case - P2P Peheat Policy CRUD
|
Test Case - P2P Preheat Policy CRUD
|
||||||
${d}= Get Current Date result_format=%m%s
|
${d}= Get Current Date result_format=%m%s
|
||||||
${pro_name}= Set Variable project_p2p${d}
|
${pro_name}= Set Variable project_p2p${d}
|
||||||
${dist_name}= Set Variable distribution${d}
|
${dist_name}= Set Variable distribution${d}
|
||||||
${endpoint}= Set Variable https://1.1.1.2
|
${endpoint}= Set Variable https://20.76.1.2
|
||||||
${policy_name}= Set Variable policy${d}
|
${policy_name}= Set Variable policy${d}
|
||||||
${repo}= Set Variable alpine
|
${repo}= Set Variable alpine
|
||||||
${repo_new}= Set Variable redis*
|
${repo_new}= Set Variable redis*
|
||||||
|
@ -111,6 +111,17 @@ Test Case - Ldap User Push An Image
|
|||||||
Test Case - Ldap User Can Not login
|
Test Case - Ldap User Can Not login
|
||||||
Docker Login Fail ${ip} testerDeesExist 123456
|
Docker Login Fail ${ip} testerDeesExist 123456
|
||||||
|
|
||||||
|
Test Case - Ldap Group Admin DN Setting
|
||||||
|
Init Chrome Driver
|
||||||
|
${d}= Get Current Date result_format=%m%s
|
||||||
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||||
|
Set LDAP Group Admin DN cn=harbor_users,ou=groups,dc=example,dc=com
|
||||||
|
Logout Harbor
|
||||||
|
Sign In Harbor ${HARBOR_URL} mike zhu88jie
|
||||||
|
Switch To Registries
|
||||||
|
Create A New Endpoint docker-hub edp1${d} https://hub.docker.com/ danfengliu Aa123456 Y
|
||||||
|
|
||||||
|
|
||||||
Test Case - Run LDAP Group Related API Test
|
Test Case - Run LDAP Group Related API Test
|
||||||
Harbor API Test ./tests/apitests/python/test_ldap_admin_role.py
|
Harbor API Test ./tests/apitests/python/test_ldap_admin_role.py
|
||||||
Harbor API Test ./tests/apitests/python/test_user_group.py
|
Harbor API Test ./tests/apitests/python/test_user_group.py
|
||||||
|
Loading…
Reference in New Issue
Block a user