Exemplo n.º 1
0
 def test_put(self):
     lims = Lims(self.url, username=self.username, password=self.password)
     uri = '{url}/api/v2/samples/test_sample'.format(url=self.url)
     with patch('requests.put', return_value=Mock(content = self.sample_xml, status_code=200)) as mocked_put:
         response = lims.put(uri=uri, data=self.sample_xml)
         assert mocked_put.call_count == 1
     with patch('requests.put', return_value=Mock(content = self.error_xml, status_code=400)) as mocked_put:
         self.assertRaises(HTTPError, lims.put, uri=uri, data=self.sample_xml)
         assert mocked_put.call_count == 1
Exemplo n.º 2
0
 def test_put(self):
     lims = Lims(self.url, username=self.username, password=self.password)
     uri = '{url}/api/v2/samples/test_sample'.format(url=self.url)
     with patch('requests.put',
                return_value=Mock(content=self.sample_xml,
                                  status_code=200)) as mocked_put:
         response = lims.put(uri=uri, data=self.sample_xml)
         assert mocked_put.call_count == 1
     with patch('requests.put',
                return_value=Mock(content=self.error_xml,
                                  status_code=400)) as mocked_put:
         self.assertRaises(HTTPError,
                           lims.put,
                           uri=uri,
                           data=self.sample_xml)
         assert mocked_put.call_count == 1