console.py
来自「一款基于web的项目管理、bug跟踪系统。提供了与svn集成的操作界面、问题跟踪」· Python 代码 · 共 997 行 · 第 1/3 页
PY
997 行
self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) # Ticket-type tests def test_ticket_type_list_ok(self): """ Tests the 'ticket_type 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('ticket_type list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_add_ok(self): """ Tests the 'ticket_type add' 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('ticket_type add new_type') rv, output = self._execute('ticket_type list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_add_error_already_exists(self): """ Tests the 'ticket_type add' command in trac-admin. This particular test passes a ticket type that already exists and checks for an error message. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('ticket_type add defect', expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_change_ok(self): """ Tests the 'ticket_type change' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('ticket_type change defect bug') rv, output = self._execute('ticket_type list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_change_error_bad_type(self): """ Tests the 'ticket_type change' command in trac-admin. This particular test tries to change a priority that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('ticket_type change bad_type changed_type') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_change_error_bad_new_name(self): """ Tests the 'ticket_type change' command in trac-admin. This particular test tries to change a ticket type to another type that already exists. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('ticket_type change defect task', expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_remove_ok(self): """ Tests the 'ticket_type 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('ticket_type remove task') rv, output = self._execute('ticket_type list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_remove_error_bad_type(self): """ Tests the 'ticket_type remove' command in trac-admin. This particular test tries to remove a ticket type that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('ticket_type remove bad_type') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_order_down_ok(self): """ Tests the 'ticket_type 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('ticket_type order defect down') rv, output = self._execute('ticket_type list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_order_up_ok(self): """ Tests the 'ticket_type 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('ticket_type order enhancement up') rv, output = self._execute('ticket_type list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_ticket_type_order_error_bad_type(self): """ Tests the 'priority 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('ticket_type order bad_type up') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) # Priority tests def test_priority_list_ok(self): """ Tests the 'priority 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('priority list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_add_ok(self): """ Tests the 'priority add' 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('priority add new_priority') rv, output = self._execute('priority list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_add_many_ok(self): """ Tests adding more than 10 priority values. This makes sure that ordering is preserved when adding more than 10 values. """ test_name = sys._getframe().f_code.co_name for i in xrange(11): self._execute('priority add p%s' % i) rv, output = self._execute('priority list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_add_error_already_exists(self): """ Tests the 'priority add' command in trac-admin. This particular test passes a priority name that already exists and checks for an error message. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('priority add blocker', expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_change_ok(self): """ Tests the 'priority change' command in trac-admin. This particular test passes valid arguments and checks for success. """ test_name = sys._getframe().f_code.co_name self._execute('priority change major normal') rv, output = self._execute('priority list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_change_error_bad_priority(self): """ Tests the 'priority change' command in trac-admin. This particular test tries to change a priority that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('priority change bad_priority changed_name') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_change_error_bad_new_name(self): """ Tests the 'priority change' command in trac-admin. This particular test tries to change a priority to a name that already exists. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('priority change major minor', expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_remove_ok(self): """ Tests the 'priority 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('priority remove major') rv, output = self._execute('priority list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_remove_error_bad_priority(self): """ Tests the 'priority remove' command in trac-admin. This particular test tries to remove a priority that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('priority remove bad_priority') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_order_down_ok(self): """ Tests the 'priority 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('priority order blocker down') rv, output = self._execute('priority list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_order_up_ok(self): """ Tests the 'priority 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('priority order critical up') rv, output = self._execute('priority list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_priority_order_error_bad_priority(self): """ Tests the 'priority 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('priority remove bad_priority') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) # Severity tests def test_severity_list_ok(self): """ Tests the 'severity 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('severity list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_add_ok(self): """ Tests the 'severity add' 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 new_severity') rv, output = self._execute('severity list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_add_error_already_exists(self): """ Tests the 'severity add' command in trac-admin. This particular test passes a severity name that already exists and checks for an error message. """ test_name = sys._getframe().f_code.co_name self._execute('severity add blocker') rv, output = self._execute('severity add blocker', expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_change_ok(self): """ Tests the 'severity 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('severity add critical') self._execute('severity change critical "end-of-the-world"') rv, output = self._execute('severity list') self.assertEqual(0, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_change_error_bad_severity(self): """ Tests the 'severity change' command in trac-admin. This particular test tries to change a severity that does not exist. """ test_name = sys._getframe().f_code.co_name rv, output = self._execute('severity change bad_severity changed_name') self.assertEqual(2, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_change_error_bad_new_name(self): """ Tests the 'severity change' command in trac-admin. This particular test tries to change a severity to a name that already exists. """ test_name = sys._getframe().f_code.co_name self._execute('severity add major') self._execute('severity add critical') rv, output = self._execute('severity change critical major', expect_exception=True) self.assertEqual(-1, rv) self.assertEqual(self.expected_results[test_name], output) def test_severity_remove_ok(self): """ Tests the 'severity add' command in trac-admin. This particular test passes a valid argument and checks for success.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?