Browse files

improved fix for suite dups

  • Loading branch information...
1 parent 3672cee commit 7807427dffdb57241b1adbd3bbaabb583b2bae82 @camd camd committed Mar 21, 2013
Showing with 34 additions and 0 deletions.
  1. +15 −0 moztrap/model/library/models.py
  2. +19 −0 tests/case/view/base.py
View
15 moztrap/model/library/models.py
@@ -115,10 +115,25 @@ class Meta:
def save(self, *args, **kwargs):
"""Save CaseVersion, updating latest version."""
skip_set_latest = kwargs.pop("skip_set_latest", False)
+ skip_sync_name = kwargs.pop("skip_sync_name", False)
super(CaseVersion, self).save(*args, **kwargs)
+
+ print("CV is \n'{0}'\nfor {1}".format(self.name, self.productversion))
+
if not skip_set_latest:
self.case.set_latest_version(update_instance=self)
+ # keep the name in sync for all caseversions
+ if not skip_sync_name:
+ for cv in self.case.versions.all():
+ if not cv == self:
+ cv.name = self.name
+ cv.save(
+ skip_sync_name=True,
+ skip_set_latest=True,
+ )
+
+
def delete(self, *args, **kwargs):
"""Delete CaseVersion, updating latest version."""
View
19 tests/case/view/base.py
@@ -217,11 +217,30 @@ def assertInList(self, response, name, count=1):
)
+ def assertIdInList(self, response, id, count=1):
+ """Assert that article's ``id`` is in the list ``count`` times."""
+ soup = self.soup(response)
+ itemlist = soup.find(True, "itemlist")
+ if itemlist is None:
+ self.fail("itemlist not found in: {0}".format(soup))
+ self.assertElement(
+ itemlist,
+ "article",
+ id=id,
+ count=count
+ )
+
+
def assertNotInList(self, response, name):
"""Assert that item ``name`` is not in the list."""
self.assertInList(response, name, 0)
+ def assertIdNotInList(self, response, id):
+ """Assert that item ``name`` is not in the list."""
+ self.assertIdInList(response, id, 0)
+
+
def assertOrderInList(self, response, *names):
"""Assert that ``names`` appear in list in given order."""
soup = self.soup(response)

0 comments on commit 7807427

Please sign in to comment.