URL: https://github.com/freeipa/freeipa/pull/5945 Author: mrizwan93 Title: #5945: ipatests: Test long certificate serial no Action: opened
PR body: """ Long certificate serial no were shown in scientific notation at user detials page. This test checks that it is no longer shown in scientific notation related:https://pagure.io/freeipa/issue/8754 Signed-off-by: Mohammad Rizwan <myu...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/5945/head:pr5945 git checkout pr5945
From 64c8277524622312e77361e1095c0a98e2dd8f52 Mon Sep 17 00:00:00 2001 From: Mohammad Rizwan <myu...@redhat.com> Date: Mon, 2 Aug 2021 18:29:04 +0530 Subject: [PATCH] Test long certificate serial no Long certificate serial no were shown in scientific notation at user detials page. This test checks that it is no longer shown in scientific notation related:https://pagure.io/freeipa/issue/8754 Signed-off-by: Mohammad Rizwan <myu...@redhat.com> --- ipatests/test_webui/data_user.py | 45 ++++++++++++++++++++++++++++++++ ipatests/test_webui/test_user.py | 31 ++++++++++++++++++++++ ipatests/test_webui/ui_driver.py | 35 +++++++++++++++++++++++++ 3 files changed, 111 insertions(+) diff --git a/ipatests/test_webui/data_user.py b/ipatests/test_webui/data_user.py index bab1bfb3359..f4622895dd1 100644 --- a/ipatests/test_webui/data_user.py +++ b/ipatests/test_webui/data_user.py @@ -253,3 +253,48 @@ 'c4qiZ6XBrfYJT2VS1yjFVj+OmGSHmrX1GdfRfco8Y1ZYC7VLwt20dutw9hKK' 'MSHI9NrJ5oOZ/GONlaKuqzKtTNb/vOIn/8yz52Od3X2Ehh1=' ) + +USER_CERT = ( + '-----BEGIN CERTIFICATE-----' + 'MIIHUzCCBTugAwIBAgIRAMbkmDZJZqhTAAAAAFZl8D0wDQYJKoZIhvcNAQELBQAw' + 'RDELMAkGA1UEBhMCSFIxHTAbBgNVBAoTFEZpbmFuY2lqc2thIGFnZW5jaWphMRYw' + 'FAYDVQQDEw1GaW5hIFJEQyAyMDE1MB4XDTE5MTAxNDEyMTMyMFoXDTIxMTAxNDEy' + 'M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fR+EipXz/phExWvRKwSOaelweOZUjz9sffpNYmvfuqmGhL5axNtj' + 'XQmAJ1wOo8m7j4Czz7m7WFtxdiZ0SYGBxnr0xpCJrHgxLU640a/T/vDPh/SSai5S' + 'E4unGGIf6vT0+5KY2gU6Jly7pqKpc44FHFrOdhWTEZzbmaiGL2QMh8VE2bAV9dNp' + 'YT7djK+WY554vVLE3N7M21qiCNxD5awuIEkpZoF1d7A/wMgAe40ZMZ6UbYawzAPf' + 'Tca3LXBLJOR4Ox2ZEbFt/JlIe7pZqR67s628axLaKCdQhOLP77KsNPMahzjQ7JmR' + 'znZSOnBy/Q==' + '-----END CERTIFICATE-----' +) diff --git a/ipatests/test_webui/test_user.py b/ipatests/test_webui/test_user.py index 17415129748..a1d6b7cadfe 100644 --- a/ipatests/test_webui/test_user.py +++ b/ipatests/test_webui/test_user.py @@ -347,6 +347,37 @@ def test_certificates(self): self.navigate_to_entity(user.ENTITY, 'search') self.delete_record(user.PKEY, user.DATA.get('del')) + @screenshot + def test_certificate_serial(self): + """Test long certificate serial no + + Long certificate serial no were shown in scientific notation + at user detials page. This test checks that it is no longer shown + in scientific notation + + related:https://pagure.io/freeipa/issue/8754 + """ + if not self.has_ca(): + self.skip('CA is not configured') + + self.init_app() + cert_widget_sel = "div.certificate-widget" + + self.add_record(user.ENTITY, user.DATA2) + self.wait() + self.close_notifications() + self.navigate_to_record(user.PKEY2) + + self.add_cert_to_record(user.USER_CERT, save=False) + # check if the cert serial is 264374074076456325397645183544606453821 + self.assert_text( + 'cert-value', '264374074076456325397645183544606453821' + ) + + # cleanup + self.navigate_to_entity(user.ENTITY, 'search') + self.delete_record(user.PKEY2, user.DATA2.get('del')) + @screenshot def test_password_expiration_notification(self): """ diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 4720d37d2b8..94fed67c884 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -2369,3 +2369,38 @@ def assert_value_checked(self, values, name, negative=False): else: assert value in checked_values, ('{} NOT checked while it ' 'should be'.format(value)) + + + def add_cert_to_record(self, pem_certs, pkey, entity='user', + navigate=False, save=True): + """ + Add certificate to particular user + + pem_certs (list): base64/pem certificate(s) + pkey (str): user/host to add the certificate to + entity (str): name of entity where to navigate if navigate=True + navigate (bool): whether we should navigate to record + save (bool): whether we should click save after adding a key + """ + + if type(pem_certs) is not list: + pem_certs = [pem_certs] + + if navigate: + self.navigate_to_entity(entity) + self.navigate_to_record(pkey) + + for cert in pem_certs: + c_add = 'div[name="Certificates"] button[name="add"]' + cert_add_btn = self.find(s_add, By.CSS_SELECTOR, strict=True) + cert_add_btn.click() + self.wait() + c_text_area = 'textarea.new_cert' + text_area = self.find(c_text_area, By.CSS_SELECTOR, strict=True) + text_area.send_keys(cert) + self.wait() + self.dialog_button_click('ok') + + # sometimes we do not want to save e.g. in order to test undo buttons + if save: + self.facet_button_click('save')
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure