示例#1
0
 def test_SingleBuildWithCrossVerify(self):
     helper = TestHelper(self, workspace='ws', env={
             'GERRIT_CHANGE_URL': 'http://gerrit',
             'GERRIT_PATCHSET_NUMBER': '3',
         })
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ],
             'gerrit_info': {
                     'change': 1234,
                     'patchset': 5
                 }
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': 'http://my_build',
             'message': None
         })
     helper.assertCommandInvoked(['ssh', '-p', '29418', '*****@*****.**', 'gerrit', 'review', '1234,5', '-m', '"Cross-verify with http://gerrit (patch set 3) finished\n\nhttp://my_build: SUCCESS"'])
示例#2
0
 def test_NoBuild(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': []
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': None,
             'message': None
         })
示例#3
0
 def test_SingleBuildWithCrossVerify(self):
     helper = TestHelper(self,
                         env={
                             'GERRIT_CHANGE_URL': 'http://gerrit',
                             'GERRIT_PATCHSET_NUMBER': '3',
                         })
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'url': 'http://my_build',
                 'desc': None,
                 'result': 'SUCCESS'
             }],
             'gerrit_info': {
                 'change': 1234,
                 'patchset': 5
             }
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {'url': 'http://my_build', 'message': None})
     helper.assertCommandInvoked([
         'ssh', '-p', '29418', '*****@*****.**', 'gerrit',
         'review', '1234,5', '-m',
         '"Cross-verify with http://gerrit (patch set 3) finished\n\nhttp://my_build: SUCCESS"'
     ])
示例#4
0
 def test_SingleBuildWithDescription(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': 'cross-verify',
                         'result': 'SUCCESS'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': 'http://my_build (cross-verify)',
             'message': None
         })
示例#5
0
 def test_SingleBuildWithoutUrl(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'title': 'My title',
                         'url': None,
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': None,
             'message': None
         })
示例#6
0
 def test_FailedSingleBuild(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': None,
                         'result': 'FAILURE',
                         'reason': 'Failure reason'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': 'http://my_build',
             'message': 'Failure reason'
         })
示例#7
0
 def test_NoBuild(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': []
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': None,
             'message': None
         })
示例#8
0
 def test_SingleBuild(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'url': 'http://my_build',
                 'desc': None,
                 'result': 'SUCCESS'
             }]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {'url': 'http://my_build', 'message': None})
示例#9
0
 def test_TwoBuildsWithoutUrl(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': 'cross-verify',
                         'result': 'SUCCESS'
                     },
                     {
                         'title': 'My title',
                         'url': None,
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': None,
             'message': 'http://my_build (cross-verify): SUCCESS\nMy title: SUCCESS'
         })
示例#10
0
 def test_TwoBuildsWithFailure(self):
     helper = TestHelper(self, workspace='ws')
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': 'cross-verify',
                         'result': 'SUCCESS'
                     },
                     {
                         'url': 'http://my_build2',
                         'desc': None,
                         'result': 'FAILURE',
                         'reason': 'Failure reason'
                     }
                 ]
         })
     do_post_build(factory, 'actions.json', 'message.json')
     helper.assertOutputJsonFile('ws/build/message.json', {
             'url': None,
             'message': 'http://my_build (cross-verify): SUCCESS\nhttp://my_build2: FAILURE <<<\nFailure reason\n>>>'
         })
示例#11
0
 def test_FailedSingleBuildWithoutUrl(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'title': 'My title',
                 'url': None,
                 'desc': None,
                 'result': 'FAILURE',
                 'reason': 'Failure reason'
             }]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {'url': None, 'message': 'Failure reason'})
示例#12
0
 def test_SingleBuildWithDescription(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': 'cross-verify',
                         'result': 'SUCCESS'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': 'http://my_build (cross-verify)',
             'message': None
         })
示例#13
0
 def test_SingleBuildWithoutUrl(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'title': 'My title',
                         'url': None,
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': None,
             'message': None
         })
示例#14
0
 def test_FailedSingleBuild(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': None,
                         'result': 'FAILURE',
                         'reason': 'Failure reason'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': 'http://my_build',
             'message': 'Failure reason'
         })
示例#15
0
 def test_TwoBuilds(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file(
         'actions.json', {
             'builds': [{
                 'url': 'http://my_build',
                 'desc': 'cross-verify',
                 'result': 'SUCCESS'
             }, {
                 'url': 'http://my_build2',
                 'desc': None,
                 'result': 'SUCCESS'
             }]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(
         result, {
             'url':
             None,
             'message':
             'http://my_build (cross-verify): SUCCESS\nhttp://my_build2: SUCCESS'
         })
示例#16
0
 def test_TwoBuildsWithoutUrl(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {
             'builds': [
                     {
                         'url': 'http://my_build',
                         'desc': 'cross-verify',
                         'result': 'SUCCESS'
                     },
                     {
                         'title': 'My title',
                         'url': None,
                         'desc': None,
                         'result': 'SUCCESS'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': None,
             'message': 'http://my_build (cross-verify): SUCCESS\nMy title: SUCCESS'
         })
示例#17
0
 def test_NoBuild(self):
     helper = TestHelper(self)
     factory = helper.factory
     helper.add_input_json_file('actions.json', {'builds': []})
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {'url': None, 'message': None})