Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
def test_plugin_extract_raises_notimplementederror():
    plugin = Plugin()

    with pytest.raises(NotImplementedError):
        plugin.extract()
Ejemplo n.º 7
0
 def test_plugin_extract_raises_notimplementederror(self):
     plugin = Plugin()
     with self.assertRaises(NotImplementedError):
         plugin.extract()
Ejemplo n.º 8
0
 def test_plugin_install_raises_notimplementederror(self):
     plugin = Plugin()
     with self.assertRaises(NotImplementedError):
         plugin.install()
Ejemplo n.º 9
0
 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)