fix: make master view auto-detect continuum versioning for model class
This commit is contained in:
parent
f33448f64a
commit
910ddca96f
2 changed files with 52 additions and 21 deletions
|
|
@ -1849,10 +1849,24 @@ class TestVersionedMasterView(VersionWebTestCase):
|
|||
def make_view(self):
|
||||
return mod.MasterView(self.request)
|
||||
|
||||
def test_is_versioned(self):
|
||||
model = self.app.model
|
||||
|
||||
with patch.object(mod.MasterView, "model_class", new=model.User):
|
||||
|
||||
# User is versioned by default
|
||||
self.assertTrue(mod.MasterView.is_versioned())
|
||||
|
||||
# but view can override w/ attr
|
||||
with patch.object(
|
||||
mod.MasterView, "model_is_versioned", new=False, create=True
|
||||
):
|
||||
self.assertFalse(mod.MasterView.is_versioned())
|
||||
|
||||
def test_defaults(self):
|
||||
model = self.app.model
|
||||
|
||||
with patch.multiple(mod.MasterView, model_class=model.User, has_versions=True):
|
||||
with patch.object(mod.MasterView, "model_class", new=model.User):
|
||||
mod.MasterView.defaults(self.pyramid_config)
|
||||
|
||||
def test_get_model_version_class(self):
|
||||
|
|
@ -1864,7 +1878,7 @@ class TestVersionedMasterView(VersionWebTestCase):
|
|||
|
||||
def test_should_expose_versions(self):
|
||||
model = self.app.model
|
||||
with patch.multiple(mod.MasterView, model_class=model.User, has_versions=True):
|
||||
with patch.object(mod.MasterView, "model_class", new=model.User):
|
||||
|
||||
# fully enabled for root user
|
||||
with patch.object(self.request, "is_root", new=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue