def setUp(self): super(NodeLogTests, self).setUp() #create a new node util.create_node(self.driver) self.driver.find_element_by_css_selector("li span a").click() self.node_url = self.driver.current_url
def setUp(self): super(NodeLogTests, self).setUp() #create a new node util.create_node(self.driver) self.driver.find_element_by_css_selector("li span a").click() self.node_url=self.driver.current_url
def create_node(self, node_id, attributes=None, node_name="Test Node Name"): return util.create_node(self.client, node_id, attributes=None, node_name="Test Node Name")
def test_add_component_log(self): """ test to make sure that creating the node log works correctly """ # As of 9 Sep 2013, the log says "node"; expected "component" #create a new node util.create_node(self.driver) #get log message_log = self.get_log() #assert the time self._assert_time(message_log.log_time) #assert the log self.assertEqual( message_log.log_text, u"{} created component {}".format( self.user_data["fullname"], config.node_title, ) ) #check the user_url self.assertEqual( message_log.log_url[0], self.get_user_url() ) #get the node url self.driver.find_element_by_css_selector("li span a").click() node_url = self.driver.current_url # check the node url # this part currently failed because something need to be fixed on the # webpage self.assertEqual( message_log.log_url[1], node_url.strip('/') )
def test_node_add_contributor_log(self): """ test to make sure that project log works correctly on adding contributor to a node """ # Log out user_url=self.get_user_url() util.logout(self.driver) # Create second user and get his url second_user_data = util.create_user(self.driver) util.login( self.driver, second_user_data['username'], second_user_data['password'] ) util.create_project(self.driver) util.create_node(self.driver) self.driver.find_element_by_css_selector("li span a").click() new_node_url=self.driver.current_url #add contributor self.add_contributor(self.user_data) #get log util.goto_project(self.driver) message_log = self.get_log() #assert the time self._assert_time(message_log.log_time) #assert the log self.assertEqual(message_log.log_text, second_user_data["fullname"] + " added " + self.user_data['fullname'] + " as contributor on node " + config.node_title) #check the second user_url, first user_url and node_url self.assertEqual(message_log.log_url[0], self.get_user_url()) self.assertEqual(message_log.log_url[1], user_url) self.assertEqual(message_log.log_url[2]+"/", new_node_url)
def test_node_add_contributor_log(self): """ test to make sure that project log works correctly on adding contributor to a node """ # Log out user_url = self.get_user_url() util.logout(self.driver) # Create second user and get his url second_user_data = util.create_user(self.driver) util.login(self.driver, second_user_data['username'], second_user_data['password']) util.create_project(self.driver) util.create_node(self.driver) self.driver.find_element_by_css_selector("li span a").click() new_node_url = self.driver.current_url #add contributor self.add_contributor(self.user_data) #get log util.goto_project(self.driver) message_log = self.get_log() #assert the time self._assert_time(message_log.log_time) #assert the log self.assertEqual( message_log.log_text, second_user_data["fullname"] + " added " + self.user_data['fullname'] + " as contributor on node " + config.node_title) #check the second user_url, first user_url and node_url self.assertEqual(message_log.log_url[0], self.get_user_url()) self.assertEqual(message_log.log_url[1], user_url) self.assertEqual(message_log.log_url[2] + "/", new_node_url)
'odds found 0': ([0, 1, 2, 3, 4], 0), 'odds found 1': ([0, 1, 2, 3, 4], 1), 'odds found 2': ([0, 1, 2, 3, 4], 2), 'odds found 3': ([0, 1, 2, 3, 4], 3), 'odds found 4': ([0, 1, 2, 3, 4], 4), 'evens not found -1': ([0, 1, 2, 3], -1), 'evens found 0': ([0, 1, 2, 3], 0), 'evens found 1': ([0, 1, 2, 3], 1), 'evens found 2': ([0, 1, 2, 3], 2), 'evens found 3': ([0, 1, 2, 3], 3), 'evens not found 4': ([0, 1, 2, 3], 4), } util.test('BINARY SEARCH', algo.bin_search, bin_search_cases) n7 = util.create_node(7) n6 = util.create_node(6) n3 = util.create_node(3, [n6, n7]) n5 = util.create_node(5) n4 = util.create_node(4) n2 = util.create_node(2, [n4, n5]) n1 = util.create_node(1, [n2, n3]) dfs_bfs_cases = { 'map-dfs': (n1, lambda x, r: r + [x.get('v')], []), 'filter-dfs': (n1, lambda x, r: r + [x.get('v')] if x.get('v') > 1 else r, []) } util.test('DFS', algo.dfs, dfs_bfs_cases)
def create_node(self,node_id, attributes=None, node_name="Test Node Name"): return util.create_node(self.client,node_id, attributes=None, node_name="Test Node Name")