Beispiel #1
0
    def test_detail(self):
        res = self.image_service.detail(self.context)
        for image in res:
            keys = set(image.keys())
            self.assertEquals(
                keys,
                set([
                    'id', 'name', 'created_at', 'updated_at', 'deleted_at',
                    'deleted', 'status', 'is_public', 'properties',
                    'disk_format', 'container_format'
                ]))
            self.assertTrue(isinstance(image['created_at'], datetime.datetime))
            self.assertTrue(isinstance(image['updated_at'], datetime.datetime))

            if not (isinstance(image['deleted_at'], datetime.datetime)
                    or image['deleted_at'] is None):
                self.fail('image\'s "deleted_at" attribute was neither a '
                          'datetime object nor None')

            def check_is_bool(image, key):
                val = image.get('deleted')
                if not isinstance(val, bool):
                    self.fail('image\'s "%s" attribute wasn\'t '
                              'a bool: %r' % (key, val))

            check_is_bool(image, 'deleted')
            check_is_bool(image, 'is_public')
Beispiel #2
0
    def test_detail(self):
        res = self.image_service.detail(self.context)
        for image in res:
            keys = set(image.keys())
            self.assertEquals(keys, set(['id', 'name', 'created_at',
                                         'updated_at', 'deleted_at', 'deleted',
                                         'status', 'is_public', 'properties']))
            self.assertTrue(isinstance(image['created_at'], datetime.datetime))
            self.assertTrue(isinstance(image['updated_at'], datetime.datetime))

            if not (isinstance(image['deleted_at'], datetime.datetime) or
                                      image['deleted_at'] is None):
                self.fail('image\'s "deleted_at" attribute was neither a '
                          'datetime object nor None')

            def check_is_bool(image, key):
                val = image.get('deleted')
                if not isinstance(val, bool):
                    self.fail('image\'s "%s" attribute wasn\'t '
                              'a bool: %r' % (key, val))

            check_is_bool(image, 'deleted')
            check_is_bool(image, 'is_public')
Beispiel #3
0
 def test_index(self):
     res = self.image_service.index(self.context)
     for image in res:
         self.assertEquals(set(image.keys()), set(['id', 'name']))
 def test_index(self):
     res = self.image_service.index(self.context)
     for image in res:
         self.assertEquals(set(image.keys()), set(['id', 'name']))