~0x44/nova/extdoc

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/test_images.py

  • Committer: Brian Waldon
  • Date: 2011-09-12 21:52:29 UTC
  • mfrom: (1558 nova)
  • mto: This revision was merged to the branch mainline in revision 1561.
  • Revision ID: brian.waldon@rackspace.com-20110912215229-5xab1wvvd11rft6g
merging trunk; resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
                    {'id': '125', 'name': 'saving snapshot'},
79
79
                    {'id': '126', 'name': 'active snapshot'},
80
80
                    {'id': '127', 'name': 'killed snapshot'},
81
 
                    {'id': '128', 'name': None}]
 
81
                    {'id': '128', 'name': 'deleted snapshot'},
 
82
                    {'id': '129', 'name': 'pending_delete snapshot'},
 
83
                    {'id': '130', 'name': None}]
82
84
 
83
85
        self.assertDictListMatch(response_list, expected)
84
86
 
122
124
                "name": "queued snapshot",
123
125
                "updated": NOW_API_FORMAT,
124
126
                "created": NOW_API_FORMAT,
125
 
                "status": "QUEUED",
 
127
                "status": "SAVING",
126
128
                "progress": 0,
127
129
                'server': {
128
130
                    'id': 42,
174
176
        self.assertEqual(expected_image.toxml(), actual_image.toxml())
175
177
 
176
178
    def test_get_image_xml_no_name(self):
177
 
        request = webob.Request.blank('/v1.0/images/128')
 
179
        request = webob.Request.blank('/v1.0/images/130')
178
180
        request.accept = "application/xml"
179
181
        app = fakes.wsgi_app(fake_auth_context=self._get_fake_context())
180
182
        response = request.get_response(app)
183
185
 
184
186
        expected_now = NOW_API_FORMAT
185
187
        expected_image = minidom.parseString("""
186
 
            <image id="128"
 
188
            <image id="130"
187
189
                    name="None"
188
190
                    updated="%(expected_now)s"
189
191
                    created="%(expected_now)s"
347
349
            },
348
350
            {
349
351
                "id": "128",
350
 
                "name": None,
 
352
                "name": "deleted snapshot",
351
353
                "links": [
352
354
                    {
353
355
                        "rel": "self",
359
361
                    },
360
362
                ],
361
363
            },
 
364
            {
 
365
                "id": "129",
 
366
                "name": "pending_delete snapshot",
 
367
                "links": [
 
368
                    {
 
369
                        "rel": "self",
 
370
                        "href": "http://localhost/v1.1/fake/images/129",
 
371
                    },
 
372
                    {
 
373
                        "rel": "bookmark",
 
374
                        "href": "http://localhost/fake/images/129",
 
375
                    },
 
376
                ],
 
377
            },
 
378
            {
 
379
                "id": "130",
 
380
                "name": None,
 
381
                "links": [
 
382
                    {
 
383
                        "rel": "self",
 
384
                        "href": "http://localhost/v1.1/fake/images/130",
 
385
                    },
 
386
                    {
 
387
                        "rel": "bookmark",
 
388
                        "href": "http://localhost/fake/images/130",
 
389
                    },
 
390
                ],
 
391
            },
362
392
        ]
363
393
 
364
394
        self.assertDictListMatch(response_list, expected)
384
414
            'name': 'queued snapshot',
385
415
            'updated': NOW_API_FORMAT,
386
416
            'created': NOW_API_FORMAT,
387
 
            'status': 'QUEUED',
 
417
            'status': 'SAVING',
388
418
            'progress': 0,
389
419
        },
390
420
        {
408
438
            'name': 'killed snapshot',
409
439
            'updated': NOW_API_FORMAT,
410
440
            'created': NOW_API_FORMAT,
411
 
            'status': 'FAILED',
 
441
            'status': 'ERROR',
412
442
            'progress': 0,
413
443
        },
414
444
        {
415
445
            'id': '128',
 
446
            'name': 'deleted snapshot',
 
447
            'updated': NOW_API_FORMAT,
 
448
            'created': NOW_API_FORMAT,
 
449
            'status': 'DELETED',
 
450
            'progress': 0,
 
451
        },
 
452
        {
 
453
            'id': '129',
 
454
            'name': 'pending_delete snapshot',
 
455
            'updated': NOW_API_FORMAT,
 
456
            'created': NOW_API_FORMAT,
 
457
            'status': 'DELETED',
 
458
            'progress': 0,
 
459
        },
 
460
        {
 
461
            'id': '130',
416
462
            'name': None,
417
463
            'updated': NOW_API_FORMAT,
418
464
            'created': NOW_API_FORMAT,
458
504
            },
459
505
            'updated': NOW_API_FORMAT,
460
506
            'created': NOW_API_FORMAT,
461
 
            'status': 'QUEUED',
 
507
            'status': 'SAVING',
462
508
            'progress': 0,
463
509
            'server': {
464
510
                'id': 42,
551
597
            },
552
598
            'updated': NOW_API_FORMAT,
553
599
            'created': NOW_API_FORMAT,
554
 
            'status': 'FAILED',
 
600
            'status': 'ERROR',
555
601
            'progress': 0,
556
602
            'server': {
557
603
                'id': 42,
575
621
        },
576
622
        {
577
623
            'id': '128',
578
 
            'name': None,
579
 
            'metadata': {},
 
624
            'name': 'deleted snapshot',
 
625
            'metadata': {
 
626
                u'instance_ref': u'http://localhost/v1.1/servers/42',
 
627
                u'user_id': u'fake',
 
628
            },
580
629
            'updated': NOW_API_FORMAT,
581
630
            'created': NOW_API_FORMAT,
582
 
            'status': 'ACTIVE',
583
 
            'progress': 100,
 
631
            'status': 'DELETED',
 
632
            'progress': 0,
 
633
            'server': {
 
634
                'id': 42,
 
635
                "links": [{
 
636
                    "rel": "self",
 
637
                    "href": server_href,
 
638
                },
 
639
                {
 
640
                    "rel": "bookmark",
 
641
                    "href": server_bookmark,
 
642
                }],
 
643
            },
584
644
            "links": [{
585
645
                "rel": "self",
586
646
                "href": "http://localhost/v1.1/fake/images/128",
590
650
                "href": "http://localhost/fake/images/128",
591
651
            }],
592
652
        },
 
653
        {
 
654
            'id': '129',
 
655
            'name': 'pending_delete snapshot',
 
656
            'metadata': {
 
657
                u'instance_ref': u'http://localhost/v1.1/servers/42',
 
658
                u'user_id': u'fake',
 
659
            },
 
660
            'updated': NOW_API_FORMAT,
 
661
            'created': NOW_API_FORMAT,
 
662
            'status': 'DELETED',
 
663
            'progress': 0,
 
664
            'server': {
 
665
                'id': 42,
 
666
                "links": [{
 
667
                    "rel": "self",
 
668
                    "href": server_href,
 
669
                },
 
670
                {
 
671
                    "rel": "bookmark",
 
672
                    "href": server_bookmark,
 
673
                }],
 
674
            },
 
675
            "links": [{
 
676
                "rel": "self",
 
677
                "href": "http://localhost/v1.1/fake/images/129",
 
678
            },
 
679
            {
 
680
                "rel": "bookmark",
 
681
                "href": "http://localhost/fake/images/129",
 
682
            }],
 
683
        },
 
684
        {
 
685
            'id': '130',
 
686
            'name': None,
 
687
            'metadata': {},
 
688
            'updated': NOW_API_FORMAT,
 
689
            'created': NOW_API_FORMAT,
 
690
            'status': 'ACTIVE',
 
691
            'progress': 100,
 
692
            "links": [{
 
693
                "rel": "self",
 
694
                "href": "http://localhost/v1.1/fake/images/130",
 
695
            },
 
696
            {
 
697
                "rel": "bookmark",
 
698
                "href": "http://localhost/fake/images/130",
 
699
            }],
 
700
        },
593
701
        ]
594
702
 
595
703
        self.assertDictListMatch(expected, response_list)