示例#1
0
 def test_list_subcommand(self):
     parser = build_parser()
     for allowed in ['projects', 'statuses', 'resolutions', 'priorities']:
         self.assertEqual(
             parser.parse_args(['list', allowed]).type,
             allowed
         )
示例#2
0
 def test_new_subcommand(self):
     parser = build_parser()
     args = parser.parse_args(
         ['new', '--project=TP', '--type=Story', 'Issue title'])
     self.assertEqual(args.title, 'Issue title')
     self.assertEqual(args.issue_project, 'TP')
     self.assertEqual(args.issue_type, 'Story')
示例#3
0
 def test_base_url_provided(self):
     parser = build_parser()
     args = parser.parse_args(
         "list projects --jira-url=http://foo.bar -u testuser -p testpass".
         split(" "))
     self.assertEqual(args.jira_url, 'http://foo.bar')
     self.assertEqual(args.username, 'testuser')
     self.assertEqual(args.password, 'testpass')
示例#4
0
 def test_new_subcommand_description_can_be_a_blank_string(self):
     """ Test that the description can be set to a blank string explicitly, when adding new issue. """
     parser = build_parser()
     args = parser.parse_args([
         'new', '--project=TP', '--type=Story', '--description=',
         'Issue title'
     ])
     self.assertEqual(args.issue_description, '')
示例#5
0
 def test_view_subcommand(self):
     parser = build_parser()
     args = parser.parse_args("view TP-10".split(" "))
     self.assertEqual(args.jira_ids, ['TP-10'])
     args = parser.parse_args("view TP-10 TP-20".split(" "))
     self.assertEqual(args.jira_ids, ['TP-10', 'TP-20'])
     args = parser.parse_args(['view', '--search=test string'])
     self.assertEqual(args.cmd, ViewCommand)
     self.assertEqual(args.search_freetext, 'test string')
     args = parser.parse_args(['view', '--search-jql=test string'])
     self.assertEqual(args.search_jql, 'test string')
     self.assertRaises(
         SystemExit, parser.parse_args,
         'view --search "blah" --search-jql="other blah"'.split(" "))
示例#6
0
 def test_view_subcommand(self):
     parser = build_parser()
     args = parser.parse_args(
         "view TP-10".split(" ")
     )
     self.assertEqual(args.jira_ids, ['TP-10'])
     args = parser.parse_args(
         "view TP-10 TP-20".split(" ")
     )
     self.assertEqual(args.jira_ids, ['TP-10', 'TP-20'])
     args = parser.parse_args(
         ['view', '--search=test string']
     )
     self.assertEqual(args.cmd, ViewCommand)
     self.assertEqual(args.search_freetext, 'test string')
     args = parser.parse_args(
         ['view','--search-jql=test string']
     )
     self.assertEqual(args.search_jql, 'test string')
     self.assertRaises(SystemExit, parser.parse_args, 'view --search "blah" --search-jql="other blah"'.split(" "))
示例#7
0
 def test_no_subcommand(self):
     parser = build_parser()
     self.assertRaises(SystemExit, parser.parse_args, "--jira-url=http://foo.bar -u testuser -p testpass".split(" "))
示例#8
0
 def test_base_url_provided(self):
     parser = build_parser()
     args = parser.parse_args("list projects --jira-url=http://foo.bar -u testuser -p testpass".split(" "))
     self.assertEqual(args.jira_url, 'http://foo.bar')
     self.assertEqual(args.username, 'testuser')
     self.assertEqual(args.password, 'testpass')
示例#9
0
 def test_new_subcommand_description_is_none_by_default(self):
     """ Test that the description is None if missing, when adding new issue. """
     parser = build_parser()
     args = parser.parse_args(
         ['new', '--project=TP', '--type=Story', 'Issue title'])
     self.assertEqual(args.issue_description, None)
示例#10
0
 def test_list_subcommand(self):
     parser = build_parser()
     for allowed in ['projects', 'statuses', 'resolutions', 'priorities']:
         self.assertEqual(
             parser.parse_args(['list', allowed]).type, allowed)
示例#11
0
 def test_no_subcommand(self):
     parser = build_parser()
     self.assertRaises(
         SystemExit, parser.parse_args,
         "--jira-url=http://foo.bar -u testuser -p testpass".split(" "))
示例#12
0
 def test_new_subcommand_description_is_none_by_default(self):
     """ Test that the description is None if missing, when adding new issue. """
     parser = build_parser()
     args = parser.parse_args(['new', '--project=TP', '--type=Story',  'Issue title'])
     self.assertEqual(args.issue_description, None)
示例#13
0
 def test_new_subcommand(self):
     parser = build_parser()
     args = parser.parse_args(['new', '--project=TP', '--type=Story',  'Issue title'])
     self.assertEqual(args.title, 'Issue title')
     self.assertEqual(args.issue_project, 'TP')
     self.assertEqual(args.issue_type, 'Story')
示例#14
0
 def test_new_subcommand_description_can_be_a_blank_string(self):
     """ Test that the description can be set to a blank string explicitly, when adding new issue. """
     parser = build_parser()
     args = parser.parse_args(['new', '--project=TP', '--type=Story', '--description=', 'Issue title'])
     self.assertEqual(args.issue_description, '')