示例#1
0
 def test_get_iddata__syntax_error(self, r_mock):
     m_resp = mock.Mock(r.Response)
     m_resp.content = 'Stuff'
     m_resp.status_code = 200
     m_resp.url = self.test_service_root
     r_mock.return_value = m_resp
     result = get_iddata('well_log', self.test_agency_cd,
                         self.test_location_id, self.test_service_root)
     self.assertIsNone(result)
示例#2
0
 def test_get_iddata_service_failure(self, r_mock):
     m_resp = mock.Mock(r.Response)
     m_resp.status_code = 500
     m_resp.url = 'http://url'
     m_resp.reason = 'reason'
     r_mock.return_value = m_resp
     with self.assertRaises(ServiceException):
         result = get_iddata('well_log', self.test_agency_cd,
                             self.test_location_id, self.test_service_root)
         # TODO this assertion is not executed
         self.assertIsNone(result)
示例#3
0
 def test_get_iddata__success(self, r_mock):
     m_resp = mock.Mock(r.Response)
     m_resp.content = self.test_xml
     m_resp.status_code = 200
     m_resp.url = self.test_service_root
     r_mock.return_value = m_resp
     result = get_iddata('well_log', self.test_agency_cd,
                         self.test_location_id, self.test_service_root)
     self.assertEqual(result.tag, 'site')
     r_mock.assert_called_with('http://fake.gov/ngwmn/iddata',
                               params={
                                   'request': 'well_log',
                                   'agency_cd': 'DOOP',
                                   'siteNo': 'BP-1729'
                               })