def test_japanese_characters(self): u""" Creates an agent and a module with japanese characters and test if the event list show the characters properly """ driver = self.driver self.login() detect_and_pass_all_wizards(driver) create_agent(driver, u"次のライセンスに基づいていま") #Create module create_module("network_server", driver, agent_name=u"次のライセンスに基づいていま", module_name=u"管理者ガイド", component_group="Network Management", network_component="Host Alive", ip="192.168.50.50") #Create alert driver.find_element_by_xpath( '//ul[@class="mn"]/li/a/img[@data-title="Alerts"]').click() Select(driver.find_element_by_id( "id_agent_module")).select_by_visible_text(u"管理者ガイド") Select(driver.find_element_by_id("template")).select_by_visible_text( "Critical condition") Select(driver.find_element_by_id( "action_select")).select_by_visible_text("Default action") driver.find_element_by_id("submit-add").click() #Force alert click_menu_element(driver, "Agent detail") driver.find_element_by_id("text-search").clear() driver.find_element_by_id("text-search").send_keys(u"次のライセンスに基づいていま") driver.find_element_by_id("submit-srcbutton").click() driver.find_element_by_css_selector("b").click() driver.find_element_by_xpath( '//ul[@class="mn"]/li/a/img[@data-title="Alerts"]').click() driver.find_element_by_xpath( '//tr[@id="table2-0"]/td/a/img[@data-title="Force"]').click() time.sleep(10) #Search events of our agent search_events(driver, agent_name=u"次のライセンスに基づいていま", module_name=u"管理者ガイド") #Check that there are japanese characters present on the event element = driver.find_element_by_xpath( u'//a[contains(.,"Alert fired (Critical condition) assigned to (管理者ガイド)")]' ) self.assertIsInstance(element, WebElement)
def test_ACL_tag(self): u"""Create agent and two modules, one without tag and with tag, create a user with tag and check this user can view module with tag and user can´t view module without tag""" agent_name = gen_random_string(6) module_name_A = gen_random_string(6) module_name_B = gen_random_string(6) user_name = gen_random_string(6) driver = self.driver self.login() detect_and_pass_all_wizards(driver) create_agent(driver, agent_name, group="Applications", ip="192.168.50.50") #We create a module without a tag create_module("network_server", driver, agent_name=agent_name, module_name=module_name_A, component_group="Network Management", network_component="Host Alive", ip="192.168.50.50") #We now create a modulo with tag "critical" create_module("network_server", driver, agent_name=agent_name, module_name=module_name_B, component_group="Network Management", network_component="Host Alive", ip="192.168.50.50", tag_name="critical") l = [("Operator (Read)", "All", ["critical"])] create_user(driver, user_name, "pandora", profile_list=l) self.logout() self.login(user=user_name) detect_and_pass_all_wizards(driver) search_agent(driver, agent_name) time.sleep(6) #The user should be able to see the module with Tag module = driver.find_element_by_xpath('//td[contains(.,"' + module_name_B + '")]') self.assertIsInstance(module, WebElement) #The user should NOT be able to see the module without tag modules = driver.find_elements_by_xpath('//td[contains(.,"' + module_name_A + '")]') self.assertEqual(modules, [])