示例#1
0
    def test_load_lgeditor(self):

        c = RestClient('localhost', lgweb_port, 10)

        # doesn't exist
        self.assertRaises(RestClientException, c._get_json, '/lg_editor?lg_name=unknown.json')
        # Defaults to first LG
        c._GET('/lg_editor')
        # also fine, LG exists
        c._GET('/lg_editor?lg_name=logical_graphs/chiles_simple.json')
示例#2
0
    def test_get_pgtjson(self):

        c = RestClient('localhost', lgweb_port, 10)
        c._GET(
            '/gen_pgt?lg_name=logical_graphs/chiles_simple.json&num_par=5&algo=metis&min_goal=0&ptype=0&max_load_imb=100')

        # doesn't exist
        self.assertRaises(RestClientException, c._get_json, '/pgt_jsonbody?pgt_name=unknown.json')
        # good!
        c._get_json('/pgt_jsonbody?pgt_name=logical_graphs/chiles_simple1_pgt.json')
示例#3
0
    def test_pg_viewer(self):

        c = RestClient('localhost', lgweb_port, 10)
        self._generate_pgt(c)

        # doesn't exist
        self.assertRaises(RestClientException, c._GET, '/pg_viewer?pgt_view_name=unknown.json')
        # Defaults to first PGT
        c._GET('/pg_viewer')
        # also fine, PGT exists
        c._GET('/pg_viewer?pgt_view_name=logical_graphs/chiles_simple1_pgt.json')
示例#4
0
    def _test_pgt_action(self, path, unknown_fails):

        c = RestClient('localhost', lgweb_port, 10)
        self._generate_pgt(c)

        # doesn't exist
        if unknown_fails:
            self.assertRaises(RestClientException, c._GET, '/' + path + '?pgt_id=unknown.json')
        else:
            c._GET('/' + path + '?pgt_id=unknown.json')

        # exists
        c._GET('/' + path + '?pgt_id=logical_graphs/chiles_simple1_pgt.json')
示例#5
0
    def _test_pgt_action(self, path, unknown_fails):

        c = RestClient("localhost", lgweb_port, timeout=10)
        self._generate_pgt(c)

        # doesn't exist
        if unknown_fails:
            self.assertRaises(
                RestClientException, c._GET, "/" + path + "?pgt_id=unknown.json"
            )
        else:
            c._GET("/" + path + "?pgt_id=unknown.json")

        # exists
        c._GET("/" + path + "?pgt_id=logical_graphs/chiles_simple1_pgt.graph")