Пример #1
0
 def test_query_invalid_4(self):
     query = "length([?contains('id', 'Publishers'])"
     with self.assertRaises(ValueError):
         CLIQuery.jmespath_type(query)
Пример #2
0
 def test_query_invalid_2(self):
     query = '[?name=My Value]'
     with self.assertRaises(ValueError):
         CLIQuery.jmespath_type(query)
Пример #3
0
 def test_query_invalid_3(self):
     query = "[].location='westus'"
     with self.assertRaises(ValueError):
         CLIQuery.jmespath_type(query)
Пример #4
0
 def test_query_unbalanced(self):
     query = 'length(@'
     with self.assertRaises(ValueError):
         CLIQuery.jmespath_type(query)
Пример #5
0
 def test_query_invalid_1(self):
     query = '[?asdf=asdf]'
     with self.assertRaises(ValueError):
         CLIQuery.jmespath_type(query)
Пример #6
0
 def test_query_empty(self):
     query = ''
     with self.assertRaises(ValueError):
         CLIQuery.jmespath_type(query)
Пример #7
0
 def test_query_valid_2(self):  # pylint: disable=no-self-use
     query = "[?propertyX.propertyY.propertyZ=='AValue'].[col1,col2]"
     # Should not raise any exception as it is valid
     CLIQuery.jmespath_type(query)
Пример #8
0
 def test_query_valid_1(self):  # pylint: disable=no-self-use
     query = 'length(@)'
     # Should not raise any exception as it is valid
     CLIQuery.jmespath_type(query)
Пример #9
0
 def test_cli_ctx_type_error(self):
     with self.assertRaises(TypeError):
         CLIQuery(cli_ctx=object())
Пример #10
0
 def setUp(self):
     self.mock_ctx = MockContext()
     self.cli_query = CLIQuery(cli_ctx=self.mock_ctx)