def test_rest_request(self, uri, http_method='GET', req_type=ReqType.JSON, body='', status=200, ret_type=RetType.JSON):
    rest_uri = ('/rest' + uri)
    if (req_type == ReqType.JSON):
        rest_uri += '.json'
    elif (req_type == ReqType.BIN):
        rest_uri += '.bin'
    elif (req_type == ReqType.HEX):
        rest_uri += '.hex'
    conn = http.client.HTTPConnection(self.url.hostname, self.url.port)
    self.log.debug('%s %s %s', http_method, rest_uri, body)
    if (http_method == 'GET'):
        conn.request('GET', rest_uri)
    elif (http_method == 'POST'):
        conn.request('POST', rest_uri, body)
    resp = conn.getresponse()
    assert_equal(resp.status, status)
    if (ret_type == RetType.OBJ):
        return resp
    elif (ret_type == RetType.BYTES):
        return resp.read()
    elif (ret_type == RetType.JSON):
        return json.loads(resp.read().decode('utf-8'), parse_float=Decimal)
def test_rest_request(self, uri, http_method='GET', req_type=ReqType.JSON, body=, status=200, ret_type=RetType.JSON):
    rest_uri = ('/rest' + uri)
    if (req_type == ReqType.JSON):
        rest_uri += '.json'
    elif (req_type == ReqType.BIN):
        rest_uri += '.bin'
    elif (req_type == ReqType.HEX):
        rest_uri += '.hex'
    conn = http.client.HTTPConnection(self.url.hostname, self.url.port)
    self.log.debug('%s %s %s', http_method, rest_uri, body)
    if (http_method == 'GET'):
        conn.request('GET', rest_uri)
    elif (http_method == 'POST'):
        conn.request('POST', rest_uri, body)
    resp = conn.getresponse()
    assert_equal(resp.status, status)
    if (ret_type == RetType.OBJ):
        return resp
    elif (ret_type == RetType.BYTES):
        return resp.read()
    elif (ret_type == RetType.JSON):
        return json.loads(resp.read().decode('utf-8'), parse_float=Decimal)