Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add tests for new branch argument for getRecentChanges()

  • Loading branch information...
commit 0ee0ee17719c0a99306c31df71811e1161090be2 1 parent a4e41e9
@jocelynj authored
Showing with 65 additions and 0 deletions.
  1. +65 −0 master/buildbot/test/unit/test_db_changes.py
View
65 master/buildbot/test/unit/test_db_changes.py
@@ -493,3 +493,68 @@ def check(changes):
{ 'notest' : ('no', 'Change') })
d.addCallback(check)
return d
+
+ def test_getRecentChanges_branch_master(self):
+ d = self.insertTestData([
+ fakedb.Change(changeid=3),
+ fakedb.Change(changeid=4, branch="1"),
+ fakedb.Change(changeid=5),
+ fakedb.Change(changeid=6),
+ fakedb.Change(changeid=7),
+ fakedb.Change(changeid=8, branch="1"),
+ fakedb.Change(changeid=9, branch="1"),
+ fakedb.Change(changeid=10),
+ fakedb.Change(changeid=11),
+ fakedb.Change(changeid=12, branch="1"),
+ ] + self.change13_rows + self.change14_rows)
+ d.addCallback(lambda _ :
+ self.db.changes.getRecentChanges(5, branch='master'))
+ def check(changes):
+ changeids = [ c['changeid'] for c in changes ]
+ self.assertEqual(changeids, [6, 7, 10, 11, 13])
+ d.addCallback(check)
+ return d
+
+ def test_getRecentChanges_branch_set(self):
+ d = self.insertTestData([
+ fakedb.Change(changeid=3),
+ fakedb.Change(changeid=4, branch="1"),
+ fakedb.Change(changeid=5),
+ fakedb.Change(changeid=6),
+ fakedb.Change(changeid=7),
+ fakedb.Change(changeid=8, branch="1"),
+ fakedb.Change(changeid=9, branch="1"),
+ fakedb.Change(changeid=10),
+ fakedb.Change(changeid=11),
+ fakedb.Change(changeid=12, branch="1"),
+ ] + self.change13_rows + self.change14_rows)
+ d.addCallback(lambda _ :
+ self.db.changes.getRecentChanges(5, branch='1'))
+ def check(changes):
+ changeids = [ c['changeid'] for c in changes ]
+ self.assertEqual(changeids, [4, 8, 9, 12])
+ d.addCallback(check)
+ return d
+
+ def test_getRecentChanges_branch_trunk(self):
+ # svnpoller.split_file_branches() uses None for trunk, so we have a different
+ # behaviour than for a normal branch
+ d = self.insertTestData([
+ fakedb.Change(changeid=3, branch=None),
+ fakedb.Change(changeid=4, branch="1"),
+ fakedb.Change(changeid=5, branch=None),
+ fakedb.Change(changeid=6, branch=None),
+ fakedb.Change(changeid=7, branch=None),
+ fakedb.Change(changeid=8, branch="1"),
+ fakedb.Change(changeid=9, branch="1"),
+ fakedb.Change(changeid=10, branch=None),
+ fakedb.Change(changeid=11, branch=None),
+ fakedb.Change(changeid=12, branch="1"),
+ ] + self.change13_rows + self.change14_rows)
+ d.addCallback(lambda _ :
+ self.db.changes.getRecentChanges(5, branch=''))
+ def check(changes):
+ changeids = [ c['changeid'] for c in changes ]
+ self.assertEqual(changeids, [5, 6, 7, 10, 11])
+ d.addCallback(check)
+ return d
Please sign in to comment.
Something went wrong with that request. Please try again.