def test_positive_update_hostname_default_prefix(self): """Update the default set prefix of hostname_prefix setting :id: 4969994d-f934-4f0e-9a98-476b87eb0527 :CaseImportance: Critical :expectedresults: Default set prefix should be updated with new value """ hostname_prefix_id = [ ele.id for ele in entities.Setting().search( query={ "per_page": 200, 'search': 'name="discovery_prefix"' }) ][0] prefix = entities.Setting(id=hostname_prefix_id).read() original_value = prefix.value try: for discovery_prefix in generate_strings_list( exclude_types=['alphanumeric', 'numeric']): prefix.value = discovery_prefix prefix = prefix.update(['value']) self.assertEqual(prefix.value, discovery_prefix) finally: setting_cleanup("discovery_prefix", original_value)
def test_positive_update_email_delivery_method_sendmail(session): """Updating Sendmail params on Email tab :id: c774e713-9640-402d-8987-c3509e918eb6 :steps: 1. Navigate to Administer > Settings > Email tab 2. Update delivery method select interface to Sendmail 3. Sendmail params configuration: 3.1. Sendmail arguments 3.2. Sendmail location 3.3. Send welcome email 4. Update "Email reply address" and "Email subject prefix" 5. Click "Test Email" button 6. Check success msg "Email was sent successfully" is shown 7. Check sent email has updated values on sender and subject accordingly :expectedresults: Email is sent through Sendmail :CaseImportance: Critical :CaseLevel: Acceptance """ property_name = "Email" mail_config_default_param = { "delivery_method": "", "email_reply_address": "", "email_subject_prefix": "", "sendmail_arguments": "", "sendmail_location": "", "send_welcome_email": "", } mail_config_default_param = { content: entities.Setting().search(query={'search': f'name={content}'})[0] for content in mail_config_default_param } mail_config_new_params = { "delivery_method": "Sendmail", "email_reply_address": f"root@{ssh.settings.server.hostname}", "email_subject_prefix": [gen_string('alpha')], "sendmail_location": "/usr/sbin/sendmail", "send_welcome_email": "Yes", } command = "grep " + f'{mail_config_new_params["email_subject_prefix"]}' + " /var/mail/root" with session: try: for mail_content, mail_content_value in mail_config_new_params.items( ): session.settings.update(mail_content, mail_content_value) test_mail_response = session.settings.send_test_mail( property_name)[0] assert test_mail_response == "Email was sent successfully" assert ssh.command(command).return_code == 0 finally: for key, value in mail_config_default_param.items(): setting_cleanup(setting_name=key, setting_value=value.value)
def test_positive_update_hostname_prefix_without_value(self): """Update the Hostname_prefix settings without any string(empty values) :id: 3867488c-d955-47af-ac0d-71f4016391d1 :expectedresults: Hostname_prefix should be set without any text """ hostname_prefix_id = [ele.id for ele in entities.Setting().search( query={"per_page": 200, 'search': 'name="discovery_prefix"'})][0] prefix = entities.Setting(id=hostname_prefix_id).read() original_value = prefix.value prefix.value = "" try: prefix = prefix.update(['value']) self.assertEqual(prefix.value, "") finally: setting_cleanup("discovery_prefix", original_value)
def test_positive_update_hostname_default_prefix(self): """Update the default set prefix of hostname_prefix setting :id: 4969994d-f934-4f0e-9a98-476b87eb0527 :expectedresults: Default set prefix should be updated with new value """ hostname_prefix_id = [ele.id for ele in entities.Setting().search( query={"per_page": 200, 'search': 'name="discovery_prefix"'})][0] prefix = entities.Setting(id=hostname_prefix_id).read() original_value = prefix.value try: for discovery_prefix in generate_strings_list( exclude_types=['alphanumeric', 'numeric']): prefix.value = discovery_prefix prefix = prefix.update(['value']) self.assertEqual(prefix.value, discovery_prefix) finally: setting_cleanup("discovery_prefix", original_value)
def test_negative_update_hostname_with_empty_fact(self): """Update the Hostname_facts settings without any string(empty values) :id: b8e260fc-e263-4292-aa2f-ab37085c7758 :expectedresults: Error should be raised on setting empty value for hostname_facts setting """ hostname_facts_id = [ ele.id for ele in entities.Setting().search( query={ "per_page": 200, 'search': 'name="discovery_hostname"' }) ][0] facts = entities.Setting(id=hostname_facts_id).read() original_value = facts.value facts.value = "" try: facts = facts.update(['value']) self.assertNotEqual(facts.value, "", msg="Empty string") finally: setting_cleanup("discovery_hostname", original_value)