Пример #1
0
 def test_throws_if_geoserver_is_unreachable(self, _):
     with patch('requests.get') as stub:
         stub.side_effect = ConnectionError()
         with self.assertRaises(geoserver.InstallError):
             geoserver.style_exists('test-style-id')
Пример #2
0
 def test_returns_true_if_exists(self, m: requests_mock.Mocker):
     m.get('/geoserver/rest/styles/test-style-id')
     self.assertTrue(geoserver.style_exists('test-style-id'))
Пример #3
0
 def test_sends_correct_credentials(self, m: requests_mock.Mocker):
     m.get('/geoserver/rest/styles/test-style-id')
     geoserver.style_exists('test-style-id')
     self.assertEqual('Basic dGVzdC11c2VybmFtZTp0ZXN0LXBhc3N3b3Jk',
                      m.request_history[0].headers['Authorization'])
Пример #4
0
 def test_returns_false_if_not_exists(self, m: requests_mock.Mocker):
     m.get('/geoserver/rest/styles/test-style-id', status_code=404)
     self.assertFalse(geoserver.style_exists('test-style-id'))
Пример #5
0
 def test_calls_correct_url(self, m: requests_mock.Mocker):
     m.get('/geoserver/rest/styles/test-style-id')
     geoserver.style_exists('test-style-id')
     self.assertEqual(
         'http://vcap-geoserver.test.localdomain/geoserver/rest/styles/test-style-id',
         m.request_history[0].url)