Exemple #1
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"'])
Exemple #2
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"'
     ])
Exemple #3
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
         })
Exemple #4
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
         })
Exemple #5
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})
Exemple #6
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'})
Exemple #7
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
         })
Exemple #8
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
         })
Exemple #9
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
         })
Exemple #10
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'
         })
Exemple #11
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
         })
Exemple #12
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'
         })
Exemple #13
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'
         })
Exemple #14
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'
         })
Exemple #15
0
 def test_TwoBuildsWithFailure(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': 'FAILURE',
                         'reason': 'Failure reason'
                     }
                 ]
         })
     result = do_post_build(factory, 'actions.json')
     self.assertEqual(result, {
             'url': None,
             'message': 'http://my_build (cross-verify): SUCCESS\nhttp://my_build2: FAILURE <<<\nFailure reason\n>>>'
         })
Exemple #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'
         })
Exemple #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})