Esempio n. 1
0
    def test_install_empty_password(self):
        """
        Test install action sets admin password if empty
        """
        zdb = Zerodb('zdb', data=self.valid_data)

        zdb.install()
        zdb._zerodb_sal.deploy.called_once_with()
        zdb.state.check('actions', 'install', 'ok')
        assert zdb.data['admin'] != ''
Esempio n. 2
0
 def test_install_empty_path(self):
     """
     Test install action sets path if empty
     """
     data = self.valid_data.copy()
     data['path'] = ''
     zdb = Zerodb('zdb', data=data)
     zdb.api = MagicMock()
     zdb.api.services.get.return_value.schedule_action.return_value.wait.return_value.result = 'path', 'name'
     zdb.install()
     assert zdb.data['path'] == 'path'
Esempio n. 3
0
    def test_install_with_password(self):
        """
        Test install action with admin password
        """
        data = self.valid_data.copy()
        data['admin'] = 'password'
        zdb = Zerodb('zdb', data=data)

        zdb.install()
        zdb._zerodb_sal.deploy.called_once_with()

        zdb.state.check('actions', 'install', 'ok')
        assert zdb.data['admin'] == 'password'
Esempio n. 4
0
    def test_install(self):
        """
        Test install action
        """
        zdb = Zerodb('zdb', data=self.valid_data)
        zdb.api.services.find_or_create = MagicMock()
        zdb._node_sal.freeports = MagicMock(return_value=[9900])

        zdb.install()

        zdb.api.services.find_or_create.assert_called_once_with(
            CONTAINER_TEMPLATE_UID,
            zdb._container_name,
            data=zdb._container_data)
        zdb.state.check('actions', 'install', 'ok')