Ejemplo n.º 1
0
    def test_get_objects_with_string_matching_filters_ends(self):
        obj1 = api.create_object(self.obj_cls, self.ctxt, {'name': 'obj1_end'})
        obj2 = api.create_object(self.obj_cls, self.ctxt, {'name': 'obj2_end'})
        obj3 = api.create_object(self.obj_cls, self.ctxt, {'name': 'obj_3'})

        objs = api.get_objects(
            self.obj_cls, self.ctxt, name=obj_utils.StringEnds('end'))
        self.assertEqual(2, len(objs))
        self.assertIn(obj1, objs)
        self.assertIn(obj2, objs)
        self.assertNotIn(obj3, objs)
Ejemplo n.º 2
0
    def test_get_values_with_string_matching_filters_ends(self):
        api.create_object(self.obj_cls, self.ctxt, {'name': 'obj1_end'})
        api.create_object(self.obj_cls, self.ctxt, {'name': 'obj2_end'})
        api.create_object(self.obj_cls, self.ctxt, {'name': 'obj_3'})

        values = api.get_values(
            self.obj_cls, self.ctxt, 'name', name=obj_utils.StringEnds('end'))
        self.assertEqual(2, len(values))
        self.assertIn('obj1_end', values)
        self.assertIn('obj2_end', values)
        self.assertNotIn('obj_3', values)
Ejemplo n.º 3
0
    def test_get_objects_with_string_matching_filters_ends(self):
        obj1 = api.create_object(self.obj_cls, self.ctxt, {'name': 'obj1_end'})
        obj2 = api.create_object(self.obj_cls, self.ctxt, {'name': 'obj2_end'})
        api.create_object(self.obj_cls, self.ctxt, {'name': 'obj_3'})

        objs = api.get_objects(
            self.obj_cls, self.ctxt, name=obj_utils.StringEnds('end'),
            _pager=base.Pager(sorts=[('name', True)]))
        self.assertEqual(2, len(objs))
        self._compare_objs(obj1, objs[0])
        self._compare_objs(obj2, objs[1])