📄 console.py
字号:
""" test_name = sys._getframe().f_code.co_name self._execute('severity remove trivial') rv, output = self._execute('severity list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_remove_error_bad_severity(self): """ Tests the 'severity remove' command in trac-admin. This particular test tries to remove a severity that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('severity remove bad_severity') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_order_down_ok(self): """ Tests the 'severity order' command in trac-admin. This particular test passes a valid argument and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('severity add foo') self._execute('severity add bar') self._execute('severity order foo down') rv, output = self._execute('severity list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_order_up_ok(self): """ Tests the 'severity order' command in trac-admin. This particular test passes a valid argument and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('severity add foo') self._execute('severity add bar') self._execute('severity order bar up') rv, output = self._execute('severity list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_order_error_bad_severity(self): """ Tests the 'severity order' command in trac-admin. This particular test tries to reorder a priority that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('severity remove bad_severity') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) # Version tests def test_version_list_ok(self): """ Tests the 'version list' command in trac-admin. Since this command has no command arguments, it is hard to call it incorrectly. As a result, there is only this one test. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('version list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_add_ok(self): """ Tests the 'version add' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('version add 9.9 "%s"' % self._test_date) rv, output = self._execute('version list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_add_error_already_exists(self): """ Tests the 'version add' command in trac-admin. This particular test passes a version name that already exists and checks for an error message. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('version add 1.0 "%s"' % self._test_date, expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_rename_ok(self): """ Tests the 'version rename' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('version rename 1.0 9.9') rv, output = self._execute('version list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_rename_error_bad_version(self): """ Tests the 'version rename' command in trac-admin. This particular test tries to rename a version that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('version rename bad_version changed_name') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_time_ok(self): """ Tests the 'version time' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('version time 2.0 "%s"' % self._test_date) rv, output = self._execute('version list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_time_unset_ok(self): """ Tests the 'version time' command in trac-admin. This particular test passes valid arguments for unsetting the date. """ test_name = sys._getframe().f_code.co_name self._execute('version time 2.0 "%s"' % self._test_date) self._execute('version time 2.0 ""') rv, output = self._execute('version list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_time_error_bad_version(self): """ Tests the 'version time' command in trac-admin. This particular test tries to change the time on a version that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('version time bad_version "%s"' % self._test_date) self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_remove_ok(self): """ Tests the 'version remove' command in trac-admin. This particular test passes a valid argument and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('version remove 1.0') rv, output = self._execute('version list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_version_remove_error_bad_version(self): """ Tests the 'version remove' command in trac-admin. This particular test tries to remove a version that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('version remove bad_version') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) # Milestone tests def test_milestone_list_ok(self): """ Tests the 'milestone list' command in trac-admin. Since this command has no command arguments, it is hard to call it incorrectly. As a result, there is only this one test. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('milestone list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_add_ok(self): """ Tests the 'milestone add' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('milestone add new_milestone "%s"' % self._test_date) rv, output = self._execute('milestone list') #self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_add_utf8_ok(self): """ Tests the 'milestone add' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute(u'milestone add \xe9tat_final "%s"' #\xc3\xa9 % self._test_date) rv, output = self._execute('milestone list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_add_error_already_exists(self): """ Tests the 'milestone add' command in trac-admin. This particular test passes a milestone name that already exists and checks for an error message. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('milestone add milestone1 "%s"' % self._test_date, expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_rename_ok(self): """ Tests the 'milestone rename' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('milestone rename milestone1 changed_milestone') rv, output = self._execute('milestone list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_rename_error_bad_milestone(self): """ Tests the 'milestone rename' command in trac-admin. This particular test tries to rename a milestone that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('milestone rename bad_milestone changed_name') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_due_ok(self): """ Tests the 'milestone due' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('milestone due milestone2 "%s"' % self._test_date) rv, output = self._execute('milestone list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_due_unset_ok(self): """ Tests the 'milestone due' command in trac-admin. This particular test passes valid arguments for unsetting the due date. """ test_name = sys._getframe().f_code.co_name self._execute('milestone due milestone2 "%s"' % self._test_date) self._execute('milestone due milestone2 ""') rv, output = self._execute('milestone list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_due_error_bad_milestone(self): """ Tests the 'milestone due' command in trac-admin. This particular test tries to change the due date on a milestone that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('milestone due bad_milestone "%s"' % self._test_date) self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_completed_ok(self): """ Tests the 'milestone completed' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('milestone completed milestone2 "%s"' % self._test_date) rv, output = self._execute('milestone list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_completed_error_bad_milestone(self): """ Tests the 'milestone completed' command in trac-admin. This particular test tries to change the completed date on a milestone that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('milestone completed bad_milestone "%s"' % self._test_date) self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_remove_ok(self): """ Tests the 'milestone remove' command in trac-admin. This particular test passes a valid argument and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('milestone remove milestone3') rv, output = self._execute('milestone list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_milestone_remove_error_bad_milestone(self): """ Tests the 'milestone remove' command in trac-admin. This particular test tries to remove a milestone that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('milestone remove bad_milestone') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_backslash_use_ok(self): test_name = sys._getframe().f_code.co_name if self._admin.interactive: self._execute('version add \\') else: self._execute(r"version add '\'") rv, output = self._execute('version list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output)def suite(): return unittest.makeSuite(TracadminTestCase, 'test')if __name__ == '__main__': unittest.main()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -