TestDenseService.py 1.4 KB
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#!/usr/bin/env python
# -*- coding:gbk -*-
"""
case created by templete
"""
import sys
sys.path.append(r'./lib/protolib')
print("sys path is : %s " % str(sys.path))

import os
import json
import commands
from lib.protolib.dense_service_pb2 import Request
from lib.protolib.dense_service_pb2 import Response
from lib.pluginlib.plugin_util import Util as ut

from lib.pluginlib.plugin_case import PluginCase
from lib.pluginlib.plugin_module import PluginModule
from lib.pluginlib.plugin_apistub import ApiStub

class TestDenseService(PluginCase):
    """test wtitleq case class"""
    OWNER="zhangwenbo03"
    quick=['ALL']
    low=[]
    daily=[]
    ignorelist=[]
    RESTART=True

    def setUp(self):
        """setup something before run case"""
        pass

    def tearDown(self):
        """tear down after run case"""
        self.t.stop()
        print "stop finished"
        pass

    def testDemoCase(self):
        """demo case"""
        req = Request()
        denseIns = req.instances.add()
        denseIns.features.append(10)
        denseIns.features.append(13)
        denseIns.features.append(200)

        service = "BuiltinDenseFormatService"
        type = "debug"

        ut_obj = ut()  
        dict_val = ut_obj.pb2dict(req)
        json_val = ut_obj.dict2json(dict_val)

        self.t.restart()
        self.t.tester.sendJsonData(json_val, service, type)

        print "execute demo case"