예제 #1
0
 def test_addChange_noprefix(self):
     cp = pb.ChangePerspective(self.master, None)
     d = cp.perspective_addChange(dict(who="bar", files=['a']))
     def check(_):
         self.assertEqual(self.added_changes,
                 [ dict(author="bar", files=['a']) ])
     d.addCallback(check)
     return d
예제 #2
0
    def testPrefix3(self):
        p = pb.ChangePerspective(self, "trunk/")

        p.perspective_addChange(d4)
        self.failUnlessEqual(len(self.changes), 1)
        c1 = self.changes[-1]
        self.failUnlessEqual(set(c1.files), set(["baz.c", "bar.c"]))
        self.failUnlessEqual(c1.comments, "mixed changes")
예제 #3
0
    def testPrefix4(self):
        p = pb.ChangePerspective(self, "branches/foobranch/")

        p.perspective_addChange(d4)
        self.failUnlessEqual(len(self.changes), 1)
        c1 = self.changes[-1]
        self.failUnlessEqual(set(c1.files), set(["foo.c"]))
        self.failUnlessEqual(c1.comments, "mixed changes")
 def testNoPrefix(self):
     p = pb.ChangePerspective(self, None)
     p.perspective_addChange(d1)
     self.failUnlessEqual(len(self.changes), 1)
     c1 = self.changes[0]
     self.failUnlessEqual(c1.files,
                          ["Project/foo.c", "Project/bar/boo.c"])
     self.failUnlessEqual(c1.comments, "Some changes in Project")
     self.failUnlessEqual(c1.who, "marvin")
예제 #5
0
    def test_addChange_files_tuple(self):
        cp = pb.ChangePerspective(self.master, None)
        d = cp.perspective_addChange(dict(files=('a', 'b')))

        def check(_):
            self.assertEqual(self.added_changes, [dict(files=['a', 'b'])])

        d.addCallback(check)
        return d
예제 #6
0
 def test_createUserObject_git_src(self):
     cp = pb.ChangePerspective(self.master, None)
     d = cp.perspective_addChange(dict(who="c <h@c>", src='git'))
     def check_change(_):
         self.assertEqual(self.added_changes, [ dict(author="c <h@c>",
                                                     files=[],
                                                     src='git') ])
     d.addCallback(check_change)
     return d
예제 #7
0
 def test_addChange_sanitize_None(self):
     cp = pb.ChangePerspective(self.master, None)
     d = cp.perspective_addChange(
             dict(project=None, revlink=None, repository=None)
             )
     def check(_):
         self.assertEqual(self.added_changes,
                 [ dict(project="", revlink="", repository="", files=[]) ])
     d.addCallback(check)
     return d
예제 #8
0
 def test_addChange_when_None(self):
     cp = pb.ChangePerspective(self.master, None)
     d = cp.perspective_addChange(
             dict(when=None)
             )
     def check(_):
         self.assertEqual(self.added_changes,
                 [ dict(when_timestamp=None, files=[]) ])
     d.addCallback(check)
     return d
예제 #9
0
 def test_addChange_non_utf8_bytestring(self):
     cp = pb.ChangePerspective(self.master, None)
     bogus_utf8 = '\xff\xff\xff\xff'
     replacement = bogus_utf8.decode('utf8', 'replace')
     d = cp.perspective_addChange(dict(author=bogus_utf8, files=['a']))
     def check(_):
         self.assertEqual(self.added_changes,
                 [ dict(author=replacement, files=['a']) ])
     d.addCallback(check)
     return d
예제 #10
0
 def test_addChange_old_param_names(self):
     cp = pb.ChangePerspective(self.master, None)
     d = cp.perspective_addChange(dict(isdir=1, who='me', when=1234,
                                       files=[]))
     def check(_):
         self.assertEqual(self.added_changes,
                 [ dict(is_dir=1, author='me', files=[],
                     when_timestamp=epoch2datetime(1234)) ])
     d.addCallback(check)
     return d
예제 #11
0
 def test_addChange_unicode_as_bytestring(self):
     cp = pb.ChangePerspective(self.master, None)
     d = cp.perspective_addChange(dict(author=u"\N{SNOWMAN}".encode('utf8'),
                 comments=u"\N{SNOWMAN}".encode('utf8'),
                 files=[u'\N{VERY MUCH GREATER-THAN}'.encode('utf8')]))
     def check(_):
         self.assertEqual(self.added_changes,
                 [ dict(author=u"\N{SNOWMAN}",
                   comments=u"\N{SNOWMAN}",
                   files=[u'\N{VERY MUCH GREATER-THAN}']) ])
     d.addCallback(check)
     return d
    def testPrefix2(self):
        p = pb.ChangePerspective(self, "Project/bar/")

        p.perspective_addChange(d1)
        self.failUnlessEqual(len(self.changes), 1)
        c1 = self.changes[-1]
        self.failUnlessEqual(c1.files, ["boo.c"])
        self.failUnlessEqual(c1.comments, "Some changes in Project")
        self.failUnlessEqual(c1.who, "marvin")

        p.perspective_addChange(d2) # should be ignored
        self.failUnlessEqual(len(self.changes), 1)

        p.perspective_addChange(d3) # should ignore this too
        self.failUnlessEqual(len(self.changes), 1)
예제 #13
0
    def test_addChange_unicode(self):
        cp = pb.ChangePerspective(self.master, None)
        d = cp.perspective_addChange(
            dict(author=u"\N{SNOWMAN}",
                 comments=u"\N{SNOWMAN}",
                 links=[u'\N{HEAVY BLACK HEART}'],
                 files=[u'\N{VERY MUCH GREATER-THAN}']))

        def check(_):
            self.assertEqual(self.added_changes, [
                dict(author=u"\N{SNOWMAN}",
                     comments=u"\N{SNOWMAN}",
                     links=[u'\N{HEAVY BLACK HEART}'],
                     files=[u'\N{VERY MUCH GREATER-THAN}'])
            ])

        d.addCallback(check)
        return d
예제 #14
0
    def test_addChange_codebase(self):
        cp = pb.ChangePerspective(self.master, None)
        yield cp.perspective_addChange(dict(who="bar", files=[], codebase='cb'))

        self.assertEqual(self.master.data.updates.changesAdded, [{
            'author': u'bar',
            'branch': None,
            'category': None,
            'codebase': u'cb',
            'comments': None,
            'files': [],
            'project': '',
            'properties': {},
            'repository': '',
            'revision': None,
            'revlink': '',
            'src': None,
            'when_timestamp': None,
        }])
예제 #15
0
    def test_createUserObject_git_src(self):
        cp = pb.ChangePerspective(self.master, None)
        yield cp.perspective_addChange(dict(who="c <h@c>", src='git'))

        self.assertEqual(self.master.data.updates.changesAdded, [{
            'author': u'c <h@c>',
            'branch': None,
            'category': None,
            'codebase': None,
            'comments': None,
            'files': [],
            'project': '',
            'properties': {},
            'repository': '',
            'revision': None,
            'revlink': '',
            'src': u'git',
            'when_timestamp': None,
        }])
    def testPrefix(self):
        p = pb.ChangePerspective(self, "Project/")

        p.perspective_addChange(d1)
        self.failUnlessEqual(len(self.changes), 1)
        c1 = self.changes[-1]
        self.failUnlessEqual(c1.files, ["foo.c", "bar/boo.c"])
        self.failUnlessEqual(c1.comments, "Some changes in Project")
        self.failUnlessEqual(c1.who, "marvin")

        p.perspective_addChange(d2) # should be ignored
        self.failUnlessEqual(len(self.changes), 1)

        p.perspective_addChange(d3) # should ignore the OtherProject file
        self.failUnlessEqual(len(self.changes), 2)

        c3 = self.changes[-1]
        self.failUnlessEqual(c3.files, ["baz.c"])
        self.failUnlessEqual(c3.comments, "mixed changes")
        self.failUnlessEqual(c3.who, "alice")
예제 #17
0
    def test_addChange_old_param_names(self):
        cp = pb.ChangePerspective(self.master, None)
        yield cp.perspective_addChange(dict(who='me', when=1234, files=[]))

        self.assertEqual(self.master.data.updates.changesAdded,
                         [{
                             'author': u'me',
                             'branch': None,
                             'category': None,
                             'codebase': None,
                             'comments': None,
                             'files': [],
                             'project': '',
                             'properties': {},
                             'repository': '',
                             'revision': None,
                             'revlink': '',
                             'src': None,
                             'when_timestamp': 1234,
                         }])
예제 #18
0
    def test_addChange_sanitize_None(self):
        cp = pb.ChangePerspective(self.master, None)
        yield cp.perspective_addChange(
            dict(project=None, revlink=None, repository=None))

        self.assertEqual(self.master.data.updates.changesAdded,
                         [{
                             'author': None,
                             'branch': None,
                             'category': None,
                             'codebase': None,
                             'comments': None,
                             'files': [],
                             'project': u'',
                             'properties': {},
                             'repository': u'',
                             'revision': None,
                             'revlink': u'',
                             'src': None,
                             'when_timestamp': None,
                         }])
예제 #19
0
    def test_addChange_unicode(self):
        cp = pb.ChangePerspective(self.master, None)
        yield cp.perspective_addChange(dict(author=u"\N{SNOWMAN}",
                                          comments=u"\N{SNOWMAN}",
                                          files=[u'\N{VERY MUCH GREATER-THAN}']))

        self.assertEqual(self.master.data.updates.changesAdded, [{
            'author': u'\u2603',
            'branch': None,
            'category': None,
            'codebase': None,
            'comments': u'\u2603',
            'files': [u'\u22d9'],
            'project': '',
            'properties': {},
            'repository': '',
            'revision': None,
            'revlink': '',
            'src': None,
            'when_timestamp': None,
        }])
예제 #20
0
    def test_addChange_non_utf8_bytestring(self):
        cp = pb.ChangePerspective(self.master, None)
        bogus_utf8 = b'\xff\xff\xff\xff'
        replacement = bogus_utf8.decode('utf8', 'replace')
        yield cp.perspective_addChange(dict(author=bogus_utf8, files=['a']))

        self.assertEqual(self.master.data.updates.changesAdded, [{
            'author': replacement,
            'branch': None,
            'category': None,
            'codebase': None,
            'comments': None,
            'files': [u'a'],
            'project': '',
            'properties': {},
            'repository': '',
            'revision': None,
            'revlink': '',
            'src': None,
            'when_timestamp': None,
        }])
예제 #21
0
파일: test_pb.py 프로젝트: levitte/buildbot
    def test_addChange_prefix(self):
        cp = pb.ChangePerspective(self.master, 'xx/')
        yield cp.perspective_addChange(dict(who="bar", files=['xx/a', 'yy/b']))

        self.assertEqual(self.master.data.updates.changesAdded,
                         [{
                             'author': 'bar',
                             'committer': None,
                             'branch': None,
                             'category': None,
                             'codebase': None,
                             'comments': None,
                             'files': ['a'],
                             'project': '',
                             'properties': {},
                             'repository': '',
                             'revision': None,
                             'revlink': '',
                             'src': None,
                             'when_timestamp': None,
                         }])
예제 #22
0
파일: test_pb.py 프로젝트: levitte/buildbot
    def test_addChange_files_tuple(self):
        cp = pb.ChangePerspective(self.master, None)
        yield cp.perspective_addChange(dict(files=('a', 'b')))

        self.assertEqual(self.master.data.updates.changesAdded,
                         [{
                             'author': None,
                             'committer': None,
                             'branch': None,
                             'category': None,
                             'codebase': None,
                             'comments': None,
                             'files': ['a', 'b'],
                             'project': '',
                             'properties': {},
                             'repository': '',
                             'revision': None,
                             'revlink': '',
                             'src': None,
                             'when_timestamp': None,
                         }])
예제 #23
0
    def test_addChange_when_None(self):
        cp = pb.ChangePerspective(self.master, None)
        d = cp.perspective_addChange(dict(when=None))

        def check(_):
            self.assertEqual(self.master.data.updates.changesAdded,
                             [{
                                 'author': None,
                                 'branch': None,
                                 'category': None,
                                 'codebase': None,
                                 'comments': None,
                                 'files': [],
                                 'project': '',
                                 'properties': {},
                                 'repository': '',
                                 'revision': None,
                                 'revlink': '',
                                 'src': None,
                                 'when_timestamp': None,
                             }])

        d.addCallback(check)
        return d
예제 #24
0
 def testCategory(self):
     p = pb.ChangePerspective(self, None)
     p.perspective_addChange(d5)
     self.failUnlessEqual(len(self.changes), 1)
     c1 = self.changes[0]
     self.failUnlessEqual(c1.category, "categoryA")