Example #1
0
 def test_get_value_as_type_with_boolean(self):
     query = Query(field='metadata.is_public',
                   op='eq',
                   value='True',
                   type='boolean')
     expected = True
     self.assertEqual(query._get_value_as_type(), expected)
Example #2
0
 def test_get_value_as_type_with_integer(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123',
                   type='integer')
     expected = 123
     self.assertEqual(query._get_value_as_type(), expected)
Example #3
0
 def test_get_value_as_type_with_string(self):
     query = Query(field='metadata.name',
                   op='eq',
                   value='linux',
                   type='string')
     expected = 'linux'
     self.assertEqual(query._get_value_as_type(), expected)
Example #4
0
 def test_get_value_as_type_with_integer(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123',
                   type='integer')
     expected = 123
     self.assertEqual(query._get_value_as_type(), expected)
Example #5
0
 def test_get_value_as_type_boolean_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string',
                   op='eq',
                   value='True or False')
     expected = 'True or False'
     self.assertEqual(query._get_value_as_type(), expected)
Example #6
0
 def test_get_value_as_type_with_boolean(self):
     query = Query(field='metadata.is_public',
                   op='eq',
                   value='True',
                   type='boolean')
     expected = True
     self.assertEqual(query._get_value_as_type(), expected)
Example #7
0
 def test_get_value_as_type_with_string(self):
     query = Query(field='metadata.name',
                   op='eq',
                   value='linux',
                   type='string')
     expected = 'linux'
     self.assertEqual(query._get_value_as_type(), expected)
Example #8
0
 def test_get_value_as_type_boolean_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string',
                   op='eq',
                   value='True or False')
     expected = 'True or False'
     self.assertEqual(query._get_value_as_type(), expected)
Example #9
0
 def test_get_value_as_type_with_float(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123.456',
                   type='float')
     expected = 123.456
     self.assertEqual(query._get_value_as_type(), expected)
Example #10
0
 def test_get_value_as_type_with_float(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123.456',
                   type='float')
     expected = 123.456
     self.assertEqual(query._get_value_as_type(), expected)
Example #11
0
 def test_get_value_as_type_integer_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string',
                   op='eq',
                   value='123-1')
     expected = '123-1'
     self.assertEqual(query._get_value_as_type(), expected)
Example #12
0
 def test_get_value_as_type_with_syntax_error_colons(self):
     # bug 1221736
     value = 'Ref::StackId'
     query = Query(field='field_name',
                   op='eq',
                   value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
Example #13
0
 def test_get_value_as_type_with_syntax_error(self):
     # bug 1221736
     value = 'WWW-Layer-4a80714f-0232-4580-aa5e-81494d1a4147-uolhh25p5xxm'
     query = Query(field='group_id',
                   op='eq',
                   value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
Example #14
0
 def test_get_value_as_type_with_syntax_error_colons(self):
     # bug 1221736
     value = 'Ref::StackId'
     query = Query(field='field_name', op='eq', value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
Example #15
0
 def test_get_value_as_type_with_syntax_error(self):
     # bug 1221736
     value = 'WWW-Layer-4a80714f-0232-4580-aa5e-81494d1a4147-uolhh25p5xxm'
     query = Query(field='group_id', op='eq', value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
Example #16
0
 def test_get_value_as_type_with_string_without_type(self):
     query = Query(field="metadata.name", op="eq", value="linux")
     expected = "linux"
     self.assertEqual(query._get_value_as_type(), expected)
Example #17
0
 def test_get_value_as_type_with_syntax_error_colons(self):
     # bug 1221736
     value = "Ref::StackId"
     query = Query(field="field_name", op="eq", value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
Example #18
0
 def test_get_value_as_type_boolean_expression_without_type(self):
     # bug 1221736
     query = Query(field="should_be_a_string", op="eq", value="True or False")
     expected = "True or False"
     self.assertEqual(query._get_value_as_type(), expected)
Example #19
0
 def test_get_value_as_type_integer_expression_without_type(self):
     # bug 1221736
     query = Query(field="should_be_a_string", op="eq", value="123-1")
     expected = "123-1"
     self.assertEqual(query._get_value_as_type(), expected)
Example #20
0
 def test_get_value_as_type_with_float_without_type(self):
     query = Query(field="metadata.size", op="eq", value="123.456")
     expected = 123.456
     self.assertEqual(query._get_value_as_type(), expected)
Example #21
0
 def test_get_value_as_type_with_boolean_without_type(self):
     query = Query(field="metadata.is_public", op="eq", value="True")
     expected = True
     self.assertEqual(query._get_value_as_type(), expected)
Example #22
0
 def test_get_value_as_type_integer_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string', op='eq', value='123-1')
     expected = '123-1'
     self.assertEqual(query._get_value_as_type(), expected)
Example #23
0
 def test_get_value_as_type_with_integer(self):
     query = Query(field="metadata.size", op="eq", value="123", type="integer")
     expected = 123
     self.assertEqual(query._get_value_as_type(), expected)