コード例 #1
0
 def test_qa_call_check_commit_message_pass(self):
     options = [
         [
             'commitcheck', '--quiet', '--message',
             "[qa] Minor clean up operations"
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             "[qa] Updated more file and fix problem #20\n\n"
             "Added more files Fixes #20",
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             "[qa] Improved Y #2\n\n"
             "Related to #2",
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             "[qa] Finished task #2\n\n"
             "Closes #2\nRelated to #1",
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             "[qa] Finished task #2\n\n"
             "Related to #2\nCloses #1",
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             "[qa] Finished task #2\n\n"
             "Related to #2\nRelated to #1",
         ],
         # noqa
         [
             'commitcheck',
             '--quiet',
             '--message',
             "[qa] Improved Y #20\n\n"
             "Simulation of a special unplanned case\n\n#noqa",
         ],
     ]
     for option in options:
         with patch('argparse._sys.argv', option):
             try:
                 check_commit_message()
             except (SystemExit, Exception) as e:
                 msg = 'Check failed:\n\n{}' '\n\nOutput:{}'.format(
                     option[-1], e)
                 self.fail(msg)
コード例 #2
0
 def test_qa_call_check_commit_message_pass(self):
     options = [
         ['commitcheck', '--quiet', '--message', '[qa] Minor clean up operations'],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Updated more file and fix problem #20\n\n'
             'Added more files Fixes #20',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Improved Y #2\n\nRelated to #2',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Finished task #2\n\nCloses #2\nRelated to #1',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Finished task #2\n\nRelated to #2\nCloses #1',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Finished task #2\n\nRelated to #2\nRelated to #1',
         ],
         # noqa
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Improved Y #20\n\n'
             'Simulation of a special unplanned case\n\n#noqa',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[fix] Fixed extensibility of openwisp-users and added sample_users test app #377\n\n'
             'Closes #377\r\n\r\nCo-authored-by: Ajay Tripathi <*****@*****.**>',
         ],
     ]
     for option in options:
         with patch('argparse._sys.argv', option), self.subTest(option):
             try:
                 check_commit_message()
             except (SystemExit, Exception) as e:
                 msg = 'Check failed:\n\n{}\n\nOutput:{}'.format(option[-1], e)
                 self.fail(msg)
コード例 #3
0
 def test_qa_call_check_commit_message_failure(self):
     options = [
         ['commitcheck'],
         ['commitcheck', '--quiet', '--message', 'Hello World'],
         ['commitcheck', '--quiet', '--message', '[qa] hello World'],
         ['commitcheck', '--quiet', '--message', '[qa] Hello World.'],
         [
             'commitcheck', '--quiet', '--message',
             '[qa] Hello World.\nFixes #20'
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Fixed problem #20\n\nFixed problem X #20',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Finished task #2\n\nResolves problem described in #2',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Fixed problem\n\nFailure #2\nRelated to #1',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Updated file and fixed problem\n\nAdded more files. Fixes #20',
         ],
         [
             'commitcheck', '--quiet', '--message',
             '[qa] Improved Y\n\nRelated to #2'
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Improved Y #2\n\nUpdated files',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             '[qa] Improved Y #20\n\nRelated to #32 Fixes #30 Fix #40',
         ],
         # issue 136
         ['commitcheck', '--quiet', '--message', '[qa] Fixed issue #20'],
     ]
     for option in options:
         with patch('argparse._sys.argv', option), self.subTest(option):
             with self.assertRaises(SystemExit):
                 check_commit_message()
コード例 #4
0
 def test_commit_failure_message(self, captured_output):
     bad_commit = [
         'commitcheck',
         '--message',
         '[qa] Updated file and fixed problem\n\nAdded more files. Fixes #20',
     ]
     with patch('argparse._sys.argv', bad_commit):
         try:
             check_commit_message()
         except (SystemExit):
             message = 'Your commit message does not follow our commit message style guidelines'
             self.assertIn(message, captured_output.getvalue())
         else:
             self.fail('SystemExit not raised')
コード例 #5
0
 def test_qa_call_check_commit_message_bump_version(self):
     options = [
         ['commitcheck', '--quiet', '--message', 'Bumped VERSION to 0.4.0'],
         [
             'commitcheck', '--quiet', '--message',
             'Bumped VERSION to 1.4.3 beta'
         ],
     ]
     for option in options:
         with patch('argparse._sys.argv', option):
             try:
                 check_commit_message()
             except (SystemExit, Exception) as e:
                 msg = 'Check failed:\n\n{}\n\nOutput:{}'.format(
                     option[-1], e)
                 self.fail(msg)
コード例 #6
0
ファイル: test_qa.py プロジェクト: pandafy/openwisp-utils
 def test_commit_failure_message(self):
     bad_commit = [
         'commitcheck', '--message',
         "[qa] Updated file and fixed problem\n\n"
         "Added more files. Fixes #20"
     ]
     with patch('argparse._sys.argv', bad_commit):
         captured_output = io.StringIO()
         sys.stdout = captured_output  # redirect stdout
         try:
             check_commit_message()
         except (SystemExit):
             message = 'Your commit message does not follow our commit message style guidelines'
             self.assertIn(message, captured_output.getvalue())
         else:
             self.fail('SystemExit not raised')
         finally:
             sys.stdout = sys.__stdout__  # reset redirect
コード例 #7
0
 def test_qa_call_check_commit_message_merge(self):
     options = [
         [
             'commitcheck',
             '--quiet',
             '--message',
             'Merge pull request #17 from TheOneAboveAllTitan/issues/16\n\n'
             '[monitoring] Added migration to create ping for existing devices. #16',
         ],
         [
             'commitcheck',
             '--quiet',
             '--message',
             "Merge branch 'issue-21' into master",
         ],
     ]
     for option in options:
         with patch('argparse._sys.argv', option), self.subTest(option):
             try:
                 check_commit_message()
             except (SystemExit, Exception) as e:
                 msg = 'Check failed:\n\n{}\n\nOutput:{}'.format(option[-1], e)
                 self.fail(msg)
コード例 #8
0
ファイル: test_qa.py プロジェクト: pandafy/openwisp-utils
 def test_qa_call_check_commit_message_failure(self):
     options = [['commitcheck'],
                [
                    'commitcheck',
                    '--quiet',
                    '--message',
                    'Hello World',
                ],
                [
                    'commitcheck',
                    '--quiet',
                    '--message',
                    '[qa] hello World',
                ],
                [
                    'commitcheck',
                    '--quiet',
                    '--message',
                    '[qa] Hello World.',
                ],
                [
                    'commitcheck',
                    '--quiet',
                    '--message',
                    '[qa] Hello World.\nFixes #20',
                ],
                [
                    'commitcheck', '--quiet', '--message',
                    "[qa] Fixed problem #20"
                    "\n\nFixed problem X #20"
                ],
                [
                    'commitcheck', '--quiet', '--message',
                    "[qa] Finished task #2\n\n"
                    "Resolves problem described in #2"
                ],
                [
                    'commitcheck', '--quiet', '--message',
                    "[qa] Fixed problem\n\n"
                    "Failure #2\nRelated to #1"
                ],
                [
                    'commitcheck', '--quiet', '--message',
                    "[qa] Updated file and fixed problem\n\n"
                    "Added more files. Fixes #20"
                ],
                [
                    'commitcheck', '--quiet', '--message',
                    "[qa] Improved Y\n\n"
                    "Related to #2"
                ],
                [
                    'commitcheck', '--quiet', '--message',
                    "[qa] Improved Y #2\n\n"
                    "Updated files"
                ],
                [
                    'commitcheck', '--quiet', '--message',
                    "[qa] Improved Y #20\n\n"
                    "Related to #32 Fixes #30 Fix #40"
                ]]
     for option in options:
         with patch('argparse._sys.argv', option):
             try:
                 check_commit_message()
             except (SystemExit):
                 pass
             else:
                 self.fail('SystemExit not raised')