def test_wait_default_juju_env(self, default_env, waiter_status): if not os.path.exists('/tmp/juju-home'): os.makedirs('/tmp/juju-home') envyaml = yaml.dump({'default': 'testing-default-env', 'environments': {'testing-default-env': {'type': 'local'}}}) with open('/tmp/juju-home/environments.yaml', 'w') as f: f.write(envyaml) waiter_status.return_value = {'test': {'0': 'started'}} default_env.return_value = 'testing-default-env' try: wait() finally: os.remove('/tmp/juju-home/environments.yaml') os.removedirs('/tmp/juju-home') waiter_status.assert_called_with(juju_env='testing-default-env')
def test_wait_not_ready(self, waiter_status): waiter_status.side_effect = [{ 'test': { '0': 'pending' } }, { 'test': { '0': 'started' } }] self.assertTrue(wait(juju_env='dummy', timeout=1))
def test_wait_default_juju_env(self, default_env, waiter_status): waiter_status.return_value = {'test': {'0': 'started'}} default_env.return_value = 'testing-default-env' wait() waiter_status.assert_called_with(juju_env='testing-default-env')
def test_wait(self, waiter_status): waiter_status.return_value = {'test': {'0': 'started'}} self.assertTrue(wait(juju_env='dummy', timeout=1)) waiter_status.assert_called_with(juju_env='dummy')
def test_wait_not_ready(self, waiter_status): waiter_status.side_effect = [{'test': {'0': 'pending'}}, {'test': {'0': 'started'}}] self.assertTrue(wait(juju_env='dummy', timeout=1))
def test_wait_juju_env(self, waiter_status): waiter_status.return_value = {'test': {'0': 'started'}} wait() waiter_status.assert_called_with(juju_env='testing-env')
def test_wait_juju_model(self, waiter_status): waiter_status.return_value = {'test': {'0': 'started'}} wait() waiter_status.assert_called_with(juju_env='testing-env')