Example #1
0
    def test_parse(self):
        self.assertEqual(QueryFilter.parse([]), [])
        x = QueryFilter.parse([{"instance-state-name": "running"}])
        self.assertEqual(
            x[0].query(), {"Name": "instance-state-name", "Values": ["running"]}
        )

        self.assertTrue(
            isinstance(QueryFilter.parse([{"tag:ASV": "REALTIMEMSG"}])[0], QueryFilter)
        )

        self.assertRaises(PolicyValidationError, QueryFilter.parse, [{"tag:ASV": None}])
Example #2
0
    def test_parse(self):
        self.assertEqual(QueryFilter.parse([]), [])
        x = QueryFilter.parse([{"instance-state-name": "running"}])
        self.assertEqual(
            x[0].query(), {"Name": "instance-state-name", "Values": ["running"]}
        )

        self.assertTrue(
            isinstance(QueryFilter.parse([{"tag:ASV": "REALTIMEMSG"}])[0], QueryFilter)
        )

        self.assertRaises(PolicyValidationError, QueryFilter.parse, [{"tag:ASV": None}])
Example #3
0
    def test_parse(self):
        self.assertEqual(QueryFilter.parse([]), [])
        x = QueryFilter.parse([{'instance-state-name': 'running'}])
        self.assertEqual(x[0].query(), {
            'Name': 'instance-state-name',
            'Values': ['running']
        })

        self.assertTrue(
            isinstance(
                QueryFilter.parse([{
                    'tag:ASV': 'REALTIMEMSG'
                }])[0], QueryFilter))

        self.assertRaises(ValueError, QueryFilter.parse, [{'tag:ASV': None}])
Example #4
0
    def test_parse(self):
        self.assertEqual(QueryFilter.parse([]), [])
        x = QueryFilter.parse(
            [{'instance-state-name': 'running'}])
        self.assertEqual(
            x[0].query(),
            {'Name': 'instance-state-name', 'Values': ['running']})

        self.assertTrue(
            isinstance(
                QueryFilter.parse(
                    [{'tag:ASV': 'REALTIMEMSG'}])[0],
                QueryFilter))

        self.assertRaises(
            ValueError,
            QueryFilter.parse,
            [{'tag:ASV': None}])