def test_update_subproject_not_in_hierarchy(self):
# Create another project hierarchy
E = self.FakeProject(id=uuidutils.generate_uuid(), parent_id=None)
F = self.FakeProject(id=uuidutils.generate_uuid(), parent_id=E.id)
E.subtree = {F.id: F.subtree}
self.project_by_id[E.id] = E
self.project_by_id[F.id] = F
qso = quota.QuotaSetOperation(self.A.id)
qso._get_project = mock.Mock()
qso._get_project.side_effect = self._get_project
self.ctx.project_id = self.A.id
updated = _make_body(tenant_id=None, root=True,
**self.test_class_quota)
expected = _make_body(tenant_id=None, root=True,
**self.test_class_expected_result)
result = qso.update(self.ctx, **updated)
self.assertDictMatch(expected, result)
# Update the quota of B to be equal to its parent quota
qso.update_hierarchy(F.id)
self.assertRaises(exceptions.HTTPForbiddenError, qso.update,
self.ctx, **updated)
评论列表
文章目录