Exemplo n.º 1
0
    def test_start_not_install(self):
        bc = Explorer('e', data=self.valid_data)
        bc._get_container = MagicMock()
        bc.api = MagicMock()
        bc._block_creator.schedule_action = MagicMock()
        bc._write_caddyfile = MagicMock()

        with pytest.raises(StateCheckError):
            bc.start()
Exemplo n.º 2
0
    def test__get_container_installed(self):
        bc = Explorer('e', data=self.valid_data)
        bc.state.set("actions", "install", "ok")
        sp = MagicMock()
        fs = MagicMock()

        fs.path = 'mypath'
        sp.get = MagicMock(return_value=fs)
        bc._node_sal.storagepools.get = MagicMock(return_value=sp)
        bc.api = MagicMock()
        bc._node_sal.client.filesystem = MagicMock()

        bc._get_caddyfile = MagicMock()
        bc._write_caddyfile = MagicMock()

        bc._get_container()

        bc._node_sal.client.filesystem.mkdir.assert_has_calls([mock.call('mypath/wallet'),
                                                               mock.call('mypath/caddy-certs')])

        assert bc._node_sal.containers.create.called
        assert bc._get_caddyfile.called
Exemplo n.º 3
0
    def test_start(self):
        bc = Explorer('e', data=self.valid_data)
        bc.state.set('actions', 'install', 'ok')
        bc._get_container = MagicMock()
        bc.api = MagicMock()
        bc._block_creator.schedule_action = MagicMock()
        bc.write_caddyfile = MagicMock()

        bc.start()

        bc._get_container.assert_called_once()
        assert bc.write_caddyfile.called

        bc.state.check('status', 'running', 'ok')
        bc.state.check('actions', 'start', 'ok')