コード例 #1
0
    def test_VIS_001_10(self):
        """
        VIS-001-10 - VIS-2: Request voyage plan with chosen UVID from VIS-1

        
        """
        response = service.get_voyageplan(url, newvoyageuvid)
        service.reportrow('VIS001sheet', 'VIS_001_10_row', 'VIS_001_10_col',
                          response.status_code == 403, response.reason)
        self.assert403(response, "Response body is : " + response.text)
コード例 #2
0
    def test_VIS_002_9_8(self):
        """
        VIS-002-1-8 - VIS-2 : Request voyage plans from VIS-1

        
        """
        response = service.get_voyageplan(url)
        service.reportrow('VIS002sheet', 'VIS_002_1_8_row', 'VIS_002_1_8_col',
                          response.status_code == 200, response.reason)
        self.assert200(response, "Response body is : " + response.text)
コード例 #3
0
    def test_VIS_002_03(self):
        """
        VIS-002-3 - VIS-2 request voyage plan with routeStatus= 7 from VIS-1, no specific UVID

        
        """
        response = service.get_voyageplan(url, routeStatus='7')
        service.reportrow('VIS002sheet', 'VIS_002_03_row', 'VIS_002_03_col',
                          response.status_code == 200, response.reason)
        self.assert200(response, "Response body is : " + response.text)
コード例 #4
0
    def test_VIS_002_08(self):
        """
        VIS-002-8 - VIS-2 request voyage plan with routeStatus= 6 (non published)  from VIS-1, no specific UVID

        
        """
        response = service.get_voyageplan(url, routeStatus='6')
        service.reportrow('VIS002sheet', 'VIS_002_08_row', 'VIS_002_08_col',
                          response.status_code == 404, response.reason)
        self.assert404(response, "Response body is : " + response.text)
コード例 #5
0
    def test_VIS_002_02(self):
        """
        VIS-002-2 - VIS-2 request voyage plan with chosen UVID from VIS-1, no specific status

        
        """
        response = service.get_voyageplan(url, voyageuvid)
        service.reportrow('VIS002sheet', 'VIS_002_02_row', 'VIS_002_02_col',
                          response.status_code == 200, response.reason)
        self.assert200(response, "Response body is : " + response.text)
コード例 #6
0
    def test_VIS_002_01(self):
        """
        VIS-002-1 - VIS-2 request voyage plan from VIS-1, no specific UVID or status, hence no parameters given

        
        """
        response = service.get_voyageplan(url)
        service.reportrow('VIS002sheet', 'VIS_002_01_row', 'VIS_002_01_col',
                          response.status_code == 200, response.reason)
        self.assert200(response, "Response body is : " + response.text)
コード例 #7
0
    def test_VIS_002_07(self):
        """
        VIS-002-7 - VIS-2 request voyage plan with another (non published) UVID from VIS-1, no specific status

        
        """
        response = service.get_voyageplan(
            url, uvid='urn:mrn:stm:voyage:id:not:found')
        service.reportrow('VIS002sheet', 'VIS_002_07_row', 'VIS_002_07_col',
                          response.status_code == 404, response.reason)
        self.assert404(response, "Response body is : " + response.text)
コード例 #8
0
    def test_VIS_002_05(self):
        """
        VIS-002-5 - VIS-2 request voyage plan with another (non published) UVID and routeStatus=7 from VIS-1

        
        """
        response = service.get_voyageplan(
            url, uvid='urn:mrn:stm:voyage:id:not:found', routeStatus='7')
        service.reportrow('VIS002sheet', 'VIS_002_05_row', 'VIS_002_05_col',
                          response.status_code == 404, response.reason)
        self.assert404(response, "Response body is : " + response.text)
コード例 #9
0
    def test_VIS_002_06(self):
        """
        VIS-002-6 - VIS-2 request voyage plan with chosen UVID and routeStatus=6 from VIS-1

        
        """
        response = service.get_voyageplan(url,
                                          uvid=voyageuvid,
                                          routeStatus='6')
        service.reportrow('VIS002sheet', 'VIS_002_06_row', 'VIS_002_06_col',
                          response.status_code == 404, response.reason)
        self.assert404(response, "Response body is : " + response.text)
コード例 #10
0
ファイル: updatevessels2.py プロジェクト: karrika/VesselVIS
''' Read all services '''
fname = 'import/vesselsnew.dat'
with open(fname) as f:
    data = json.loads(f.read())
os.remove(fname)
''' Set all services to valid for the check '''
fname = 'import/vessels.dat'
with open(fname, 'w') as f:
    f.write(json.dumps(data))
''' Set the set to include only new or unvalid services '''
for item in dataold:
    if item in data:
        data.remove(item)
''' Check the set of new or unvalid services '''
for srv in data:
    ret = service.get_voyageplan(srv['endpointUri'])
    if (ret.status_code == 500) and (ret.text == 'SSLError'):
        print(srv['name'])
    else:
        dataold.append(srv)
mapping_set = []
for item in sorted(dataold, key=methodcaller('get', 'name', None)):
    mapping_data = collections.OrderedDict()
    mapping_data['name'] = item['name']
    mapping_data['endpointUri'] = item['endpointUri']
    mapping_data['instanceId'] = item['instanceId']
    mapping_set.append(mapping_data)
''' Save the modified set of valid services '''
with open(fname, 'w') as f:
    f.write(json.dumps(mapping_set))