Esempio n. 1
0
 def testProcessLabelIDCond_NegatedNoValue(self):
     fd = BUILTIN_ISSUE_FIELDS['label_id']
     cond = ast_pb2.MakeCond(ast_pb2.QueryOp.NE, [fd], [], [])
     left_joins, where = ast2select._ProcessLabelIDCond(
         cond, 'Cond1', 'User1')
     self.assertEqual([], left_joins)
     self.assertEqual([], where)
Esempio n. 2
0
 def testProcessLabelIDCond_NegatedMultipleValue(self):
     fd = BUILTIN_ISSUE_FIELDS['label_id']
     cond = ast_pb2.MakeCond(ast_pb2.QueryOp.NE, [fd], [], [1, 2])
     left_joins, where = ast2select._ProcessLabelIDCond(
         cond, 'Cond1', 'User1')
     self.assertEqual(
         [('Issue2Label AS Cond1 ON Issue.id = Cond1.issue_id AND '
           'Issue.shard = Cond1.issue_shard AND '
           'Cond1.label_id IN (%s,%s)', [1, 2])], left_joins)
     self.assertTrue(sql._IsValidJoin(left_joins[0][0]))
     self.assertEqual([('Cond1.label_id IS NULL', [])], where)
     self.assertTrue(sql._IsValidWhereCond(where[0][0]))
Esempio n. 3
0
 def testProcessLabelIDCond_NoValue(self):
     fd = BUILTIN_ISSUE_FIELDS['label_id']
     cond = ast_pb2.MakeCond(ast_pb2.QueryOp.EQ, [fd], [], [])
     with self.assertRaises(ast2select.NoPossibleResults):
         ast2select._ProcessLabelIDCond(cond, 'Cond1', 'User1')