Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
improved fix for suite dups
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Dawson committed Mar 21, 2013
1 parent 3672cee commit 7807427
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions moztrap/model/library/models.py
Expand Up @@ -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."""
Expand Down
19 changes: 19 additions & 0 deletions tests/case/view/base.py
Expand Up @@ -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)
Expand Down

0 comments on commit 7807427

Please sign in to comment.