示例#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)
示例#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
示例#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)
示例#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
示例#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
示例#6
0
def test_plugin_extract_raises_notimplementederror():
    plugin = Plugin()

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