Пример #1
0
 def test_smartfetch_ok(self):
     """[summary]
     """
     with patch('requests.post') as mock_requests:
         mock_requests.return_value.status_code = 200
         smart_fetch = SmartFetch('')
         smart_fetch.post(code=200)
         self.assertIsInstance(smart_fetch, SmartFetch)
Пример #2
0
 def test_smartfetch_fails(self):
     """
     Test that errors are properly raised on a failed request.
     """
     with patch('requests.post') as mock_requests:
         mock_requests.return_value.status_code = 200
         with self.assertRaises(RuntimeError):
             smart_fetch = SmartFetch('')
             smart_fetch.post(code=300)
Пример #3
0
def test_smartfetch_fails():
    """[summary]
    """
    with patch('requests.post') as mock_requests:
        mock_requests.return_value.status_code = 200
        smart_fetch = SmartFetch('')
        value = smart_fetch.post(code=200)
        assert value.status_code == 200