def test_basic(self): sot = sf.StackFiles() self.assertFalse(sot.allow_create) self.assertTrue(sot.allow_fetch) self.assertFalse(sot.allow_commit) self.assertFalse(sot.allow_delete) self.assertFalse(sot.allow_list)
def test_basic(self): sot = sf.StackFiles() self.assertEqual('orchestration', sot.service.service_type) self.assertFalse(sot.allow_create) self.assertTrue(sot.allow_get) self.assertFalse(sot.allow_update) self.assertFalse(sot.allow_delete) self.assertFalse(sot.allow_list)
def get_stack_files(self, stack): """Get files used by a stack :param stack: The value can be the ID of a stack or an instance of :class:`~openstack.orchestration.v1.stack.Stack` :returns: A dictionary containing the names and contents of all files used by the stack. :raises: :class:`~openstack.exceptions.ResourceNotFound` when the stack cannot be found. """ if isinstance(stack, _stack.Stack): stk = stack else: stk = self._find(_stack.Stack, stack, ignore_missing=False) obj = _stack_files.StackFiles(stack_name=stk.name, stack_id=stk.id) return obj.get(self._session)
def test_get(self, mock_prepare_request): resp = mock.Mock() resp.json = mock.Mock(return_value={'file': 'file-content'}) sess = mock.Mock() sess.get = mock.Mock(return_value=resp) sot = sf.StackFiles(**FAKE) sot.service = mock.Mock() req = mock.MagicMock() req.url = ('/stacks/%(stack_name)s/%(stack_id)s/files' % {'stack_name': FAKE['stack_name'], 'stack_id': FAKE['stack_id']}) mock_prepare_request.return_value = req files = sot.get(sess) sess.get.assert_called_once_with(req.url) self.assertEqual({'file': 'file-content'}, files)
def test_make_it(self): sot = sf.StackFiles(**FAKE) self.assertEqual(FAKE['stack_id'], sot.stack_id) self.assertEqual(FAKE['stack_name'], sot.stack_name)