def test_plugin_download(self): plugin = Plugin() with patch('aws_gate.bootstrap.os'), \ patch('aws_gate.bootstrap.shutil'), \ patch('aws_gate.bootstrap.requests', return_value=MagicMock()) as requests_mock: plugin.download() self.assertTrue(requests_mock.get.called)
def test_plugin_download(mocker): mocker.patch("aws_gate.bootstrap.os") mocker.patch("aws_gate.bootstrap.shutil") requests_mock = mocker.patch("aws_gate.bootstrap.requests") plugin = Plugin() plugin.download() assert requests_mock.get.called
def test_plugin_download_exception(self): plugin = Plugin() with patch('aws_gate.bootstrap.os'), \ patch('aws_gate.bootstrap.shutil'), \ patch('aws_gate.bootstrap.logger.error') as m, \ patch('aws_gate.bootstrap.requests.get', side_effect=requests.exceptions.HTTPError): plugin.download() self.assertTrue(m.called)
def test_plugin_download_exception(mocker): mocker.patch("aws_gate.bootstrap.os") mocker.patch("aws_gate.bootstrap.shutil") mocker.patch("aws_gate.bootstrap.requests.get", side_effect=requests.exceptions.HTTPError) m = mocker.patch("aws_gate.bootstrap.logger.error") plugin = Plugin() plugin.download() assert m.called
def test_plugin_is_installed(mocker): mocker.patch("aws_gate.bootstrap.shutil.which", return_value=PLUGIN_INSTALL_PATH) plugin = Plugin() assert not plugin.is_installed
def test_plugin_extract_raises_notimplementederror(): plugin = Plugin() with pytest.raises(NotImplementedError): plugin.extract()
def test_plugin_extract_raises_notimplementederror(self): plugin = Plugin() with self.assertRaises(NotImplementedError): plugin.extract()
def test_plugin_install_raises_notimplementederror(self): plugin = Plugin() with self.assertRaises(NotImplementedError): plugin.install()
def test_plugin_is_installed(self): with patch('aws_gate.bootstrap.shutil.which', return_value=PLUGIN_INSTALL_PATH): plugin = Plugin() self.assertFalse(plugin.is_installed)