|
4 | 4 | from tests import clicomm |
5 | 5 |
|
6 | 6 | class QueryTest(unittest.TestCase): |
| 7 | + maxDiff = None |
7 | 8 |
|
8 | 9 | def testBasicQuery(self): |
9 | 10 | q = clicomm("bugzilla --debug query --product foo --component bar") |
10 | 11 | self.assertDictEqual(q, {'product': ['foo'], 'component': 'bar', |
11 | 12 | 'include_fields': ['bug_id', 'bug_status', 'assigned_to', |
12 | 13 | 'short_desc']}) |
| 14 | + |
| 15 | + def testOnline(self): |
| 16 | + q = clicomm("bugzilla --debug query --product foo --oneline") |
| 17 | + self.assertDictEqual(q, {'product': ['foo'], 'include_fields': |
| 18 | + ['bug_id', 'bug_status', 'assigned_to', 'component', |
| 19 | + 'target_milestone', 'short_desc', 'flags', 'keywords', |
| 20 | + 'blockedby']}) |
| 21 | + |
| 22 | + def testBugStatusALL(self): |
| 23 | + q = clicomm("bugzilla --debug query --product foo --bug_status ALL") |
| 24 | + self.assertDictEqual(q, {'product': ['foo'], 'include_fields': |
| 25 | + ['bug_id', 'bug_status', 'assigned_to', 'short_desc'], |
| 26 | + 'include_fields': ['bug_id', 'bug_status', 'assigned_to', |
| 27 | + 'short_desc']}) |
| 28 | + def testBugStatusDEV(self): |
| 29 | + q = clicomm("bugzilla --debug query --bug_status DEV") |
| 30 | + self.assertDictEqual(q, {'bug_status': ['NEW', 'ASSIGNED', 'NEEDINFO', |
| 31 | + 'ON_DEV', 'MODIFIED', 'POST', 'REOPENED'], 'include_fields': |
| 32 | + ['bug_id', 'bug_status', 'assigned_to', 'short_desc'], |
| 33 | + 'include_fields': ['bug_id', 'bug_status', 'assigned_to', |
| 34 | + 'short_desc']}) |
| 35 | + def testBugStatusQE(self): |
| 36 | + q = clicomm("bugzilla --debug query --bug_status QE") |
| 37 | + self.assertDictEqual(q, {'bug_status': ['ASSIGNED', 'ON_QA', |
| 38 | + 'FAILS_QA', 'PASSES_QA'], 'include_fields': ['bug_id', |
| 39 | + 'bug_status', 'assigned_to', 'short_desc'], 'include_fields': |
| 40 | + ['bug_id', 'bug_status', 'assigned_to', 'short_desc']}) |
| 41 | + def testBugStatusEOL(self): |
| 42 | + q = clicomm("bugzilla --debug query --bug_status EOL") |
| 43 | + self.assertDictEqual(q, {'bug_status': ['VERIFIED', 'RELEASE_PENDING', |
| 44 | + 'CLOSED'], 'include_fields': ['bug_id', 'bug_status', |
| 45 | + 'assigned_to', 'short_desc'], 'include_fields': ['bug_id', |
| 46 | + 'bug_status', 'assigned_to', 'short_desc']}) |
| 47 | + def testBugStatusOPEN(self): |
| 48 | + q = clicomm("bugzilla --debug query --bug_status OPEN") |
| 49 | + self.assertDictEqual(q, {'bug_status': ['NEW', 'ASSIGNED', 'MODIFIED', |
| 50 | + 'ON_DEV', 'ON_QA', 'VERIFIED', 'RELEASE_PENDING', 'POST'], |
| 51 | + 'include_fields': ['bug_id', 'bug_status', 'assigned_to', |
| 52 | + 'short_desc']}) |
| 53 | + def testBugStatusRegular(self): |
| 54 | + q = clicomm("bugzilla --debug query --bug_status POST") |
| 55 | + self.assertDictEqual(q, {'bug_status': ['POST'], 'include_fields': |
| 56 | + ['bug_id', 'bug_status', 'assigned_to', 'short_desc']}) |
| 57 | + |
| 58 | + def testEmailOptions(self): |
| 59 | + q = clicomm( "bugzilla --debug query --cc [email protected] " |
| 60 | + "--assigned_to [email protected]") |
| 61 | + self. assertDictEqual( q, { 'email1': '[email protected]', |
| 62 | + 'emailassigned_to2': True, 'emailtype2': 'substring', 'emailtype1': |
| 63 | + 'substring', 'email2': '[email protected]', 'emailcc1': True, |
| 64 | + 'include_fields': ['bug_id', 'bug_status', 'assigned_to', |
| 65 | + 'short_desc'], 'query_format' : 'advanced'}) |
| 66 | + |
| 67 | + def testComponentsFile(self): |
| 68 | + q = clicomm("bugzilla --debug query --components_file " + |
| 69 | + os.getcwd() + "/tests/data/components_file.txt") |
| 70 | + self.assertDictEqual(q, {'component': 'foo,bar,baz', 'include_fields': |
| 71 | + ['bug_id', 'bug_status', 'assigned_to', 'short_desc']}) |
| 72 | + |
| 73 | + def testKeywords(self): |
| 74 | + q = clicomm("bugzilla --debug query --keywords Triaged " |
| 75 | + "--url http://example.com --url_type foo") |
| 76 | + self.assertDictEqual(q, {'keywords': 'Triaged', 'bug_file_loc': |
| 77 | + 'http://example.com', 'bug_file_loc_type': 'foo', |
| 78 | + 'include_fields': ['bug_id', 'bug_status', 'assigned_to', |
| 79 | + 'short_desc']}) |
| 80 | + |
| 81 | + def testBooleans(self): |
| 82 | + q = clicomm("bugzilla --debug query --blocked 123456 " |
| 83 | + "--devel_whiteboard 'foobar | baz' " |
| 84 | + "--qa_whiteboard '! baz' " |
| 85 | + "--flag 'needinfo & devel_ack'") |
| 86 | + self.assertDictEqual(q, {'value2-0-0': 'baz', 'value0-0-0': '123456', |
| 87 | + 'type3-0-1': 'substring', 'value1-1-0': 'devel_ack', 'type0-0-0': |
| 88 | + 'substring', 'type2-0-0': 'substring', 'field3-0-1': |
| 89 | + 'cf_devel_whiteboard', 'field3-0-0': 'cf_devel_whiteboard', |
| 90 | + 'field1-0-0': 'flagtypes.name', 'value3-0-0': 'foobar', |
| 91 | + 'value3-0-1': 'baz', 'value1-0-0': 'needinfo', 'type1-1-0': |
| 92 | + 'substring', 'type1-0-0': 'substring', 'field1-1-0': |
| 93 | + 'flagtypes.name', 'negate2': 1, 'field2-0-0': |
| 94 | + 'cf_qa_whiteboard', 'type3-0-0': 'substring', 'field0-0-0': |
| 95 | + 'blocked', 'include_fields': ['bug_id', 'bug_status', |
| 96 | + 'assigned_to', 'short_desc'], 'query_format': 'advanced'}) |
| 97 | + |
| 98 | + def testBooleanChart(self): |
| 99 | + q = clicomm("bugzilla --debug query " |
| 100 | + "--boolean_query 'keywords-substring-Partner & " |
| 101 | + "keywords-notsubstring-OtherQA' " |
| 102 | + "--boolean_query 'foo-bar-baz | foo-bar-wee' " |
| 103 | + "--boolean_query '! foo-bar-yargh'") |
| 104 | + self.assertDictEqual(q, {'value1-0-1': 'wee', 'value2-0-0': 'yargh', |
| 105 | + 'field2-0-0': 'foo', 'value0-0-0': 'Partner', 'type0-0-0': |
| 106 | + 'substring', 'type2-0-0': 'bar', 'field1-0-1': 'foo', 'field1-0-0': |
| 107 | + 'foo', 'value1-0-0': 'baz', 'field0-1-0': 'keywords', 'field0-0-0': |
| 108 | + 'keywords', 'type1-0-0': 'bar', 'type1-0-1': 'bar', 'negate2': 1, |
| 109 | + 'type0-1-0': 'notsubstring', 'value0-1-0': 'OtherQA', |
| 110 | + 'include_fields': ['bug_id', 'bug_status', 'assigned_to', |
| 111 | + 'short_desc'], 'query_format': 'advanced'}) |
0 commit comments