Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_enumeration(self, mock_get):
mock_get.return_value = Mock(ok=True)
mock_get.return_value.json.return_value = {
'results': {
'bindings': [
{'o1': {'value': 'v1'}},
{'o1': {'value': 'v2'}}
]
}
}
rq, _ = self.loader.getTextForName('test-rq')
metadata = {'enumerate': 'o1'}
enumeration = gquery.get_enumeration(rq, 'o1', 'http://mock-endpoint/sparql', metadata)
self.assertIsInstance(enumeration, list, 'Should return a list of values')
self.assertEqual(len(enumeration), 2, 'Should have two elements')
def test_get_static_enumeration(self):
rq, _ = self.loader.getTextForName('test-enum')
metadata = gquery.get_yaml_decorators(rq)
self.assertIn('enumerate', metadata, 'Should contain enumerate')
enumeration = gquery.get_enumeration(rq, 'o', 'http://mock-endpoint/sparql', metadata)
self.assertIsInstance(enumeration, list, 'Should return a list of values')
self.assertEqual(len(enumeration), 2, 'Should have two elements')