Пример #1
0
 def test_get_node(self):
     js_node1 = self.test_create_flow_node()
     node1 = interface.convert_json2node_container(js_node1,self.P)
     url = '/buildbot/api/v1.0/node/{label}/{id}'
     response = self.get(url, node1.dict())
     node2 = interface.convert_json2node_container(response.data,self.P)
     
     # Check that they match
     assert( node1 == node2 )
Пример #2
0
    def test_update_node(self):
        js_node1 = self.test_create_flow_node()
        node1 = interface.convert_json2node_container(js_node1,self.P)
        
        # Change the status
        node1["status"] *= 2
        json_string2 = node1.json()
        
        response = self.post('/buildbot/api/v1.0/node/{label}/update',
                             node1.dict())
        node2 = interface.convert_json2node_container(response.data,self.P)

        # Check that the returned node is updated
        assert(node1 == node2)
Пример #3
0
 def test_remove_node(self):
     js_node1 = self.test_create_flow_node()
     node1 = interface.convert_json2node_container(js_node1,self.P)
     url = '/buildbot/api/v1.0/node/{label}/remove'
     response = self.delete(url,node1.dict())
     stats = json.loads(response.data)
     assert(stats["nodes_deleted"]==1)
Пример #4
0
 def test_node_json(self):
     P = self.package
     node1     = P.nodes["flow"](**self.flow_data)
     json_text = node1.json()
     node2     = interface.convert_json2node_container(json_text,P)
     assert(node1 == node2)
     assert( node1.id == node2.id )
Пример #5
0
    def test_create_relationship(self):
        js_node1 = self.test_create_flow_node()
        node1 = interface.convert_json2node_container(js_node1,self.P)

        js_node1 = self.test_create_flow_node()
        node2 = interface.convert_json2node_container(js_node1,self.P)

        rel_data = {
            "start_id":node1.id,
            "end_id"  :node2.id,
            "label":"depends",
            "start":node1.label,
            "end":node2.label,
        }
        url = '/buildbot/api/v1.0/relationship/{start}/{label}/{end}/create'
        
        response = self.post(url,data=rel_data)
        return response.data
Пример #6
0
 def test_search_node(self):
     js_node1 = self.test_create_flow_node()
     node1 = interface.convert_json2node_container(js_node1,self.P)
     search_query = node1.dict()
     search_query.pop("id")
     
     response = self.get('/buildbot/api/v1.0/node/{label}/search',
                         search_query)
     match_idx = json.loads(response.data)
     assert(node1.id in match_idx["match_nodes"])
     return match_idx["match_nodes"]