From 96f62fcc2e2cc6c6d37c44be64a1aab9c797a726 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Apr 05 2018 06:12:28 +0000 Subject: webui:tests: realm domain add with DNS check Try adding and deleting with "Check DNS" (in html 'ok' button) DNS check expects that the added domain will have DNS record: TXT _kerberos.$domain "$REALM" When a new domain is added using dnszone-add it automatically adds this TXT record and adds a realm domain. So in order to test without external DNS we must get into state where realm domain is not added (in order to add it) but DNS domain with the TXT record exists. https://pagure.io/freeipa/issue/7481 Reviewed-By: Petr Cech Reviewed-By: Petr Cech --- diff --git a/ipatests/test_webui/test_realmdomains.py b/ipatests/test_webui/test_realmdomains.py index e7737c9..d53f23e 100644 --- a/ipatests/test_webui/test_realmdomains.py +++ b/ipatests/test_webui/test_realmdomains.py @@ -23,6 +23,9 @@ Realm domains tests from ipatests.test_webui.ui_driver import UI_driver from ipatests.test_webui.ui_driver import screenshot +from ipatests.test_webui.data_dns import ( + ZONE_ENTITY, ZONE_DATA, ZONE_PKEY, ZONE_DEFAULT_FACET +) import pytest ENTITY = 'realmdomains' @@ -31,6 +34,12 @@ ENTITY = 'realmdomains' @pytest.mark.tier1 class test_realmdomains(UI_driver): + def del_realm_domain(self, realmdomain, button): + self.del_multivalued('associateddomain', realmdomain) + self.facet_button_click('save') + self.dialog_button_click(button) + self.wait_for_request() + @screenshot def test_read(self): """ @@ -39,15 +48,60 @@ class test_realmdomains(UI_driver): self.init_app() self.navigate_to_entity(ENTITY) - # add + # add with force - skipping DNS check self.add_multivalued('associateddomain', 'itest.bar') self.facet_button_click('save') self.dialog_button_click('force') self.wait_for_request() # delete - self.del_multivalued('associateddomain', 'itest.bar') - self.facet_button_click('save') - self.dialog_button_click('force') + self.del_realm_domain('itest.bar', 'force') self.wait_for_request() + + # Try adding and deleting with "Check DNS" (in html 'ok' button) + + # DNS check expects that the added domain will have DNS record: + # TXT _kerberos.$domain "$REALM" + # When a new domain is added using dnszone-add it automatically adds + # this TXT record and adds a realm domain. So in order to test without + # external DNS we must get into state where realm domain is not added + # (in order to add it) but DNS domain with the TXT record + # exists. + + # add DNS domain + self.navigate_to_entity(ZONE_ENTITY) + self.add_record(ZONE_ENTITY, ZONE_DATA) + + realmdomain = ZONE_PKEY.strip('.') + realm = self.config.get('ipa_realm') + + # remove the added domain from Realm Domain + self.navigate_to_entity(ENTITY) + self.del_realm_domain(realmdomain, 'ok') + + # re-add _TXT kerberos.$domain "$REALM" + self.navigate_to_entity(ZONE_ENTITY) + self.navigate_to_record(ZONE_PKEY) + + DNS_RECORD_ADD_DATA = { + 'pkey': '_kerberos', + 'add': [ + ('textbox', 'idnsname', '_kerberos'), + ('selectbox', 'record_type', 'txtrecord'), + ('textbox', 'txt_part_data', realm), + ] + } + self.add_record(ZONE_ENTITY, DNS_RECORD_ADD_DATA, + facet=ZONE_DEFAULT_FACET, navigate=False) + + # add Realm Domain and Check DNS + self.navigate_to_entity(ENTITY) + self.add_multivalued('associateddomain', realmdomain) + self.facet_button_click('save') + self.dialog_button_click('ok') self.wait_for_request() + + # cleanup + self.del_realm_domain(realmdomain, 'ok') + self.navigate_to_entity(ZONE_ENTITY) + self.delete_record(ZONE_PKEY)