@@ -738,3 +738,28 @@ def test_images_with_invalid_id(self):
738
738
version = '2.81' )
739
739
self .assertRaises (exc .HTTPBadRequest , self .controller .images ,
740
740
req , 'foo' , body = body )
741
+
742
+ def test_images_with_duplicate_id (self ):
743
+ body = {"cache" : [{"id" : "faae1bd3-c848-41d6-b4dd-97d5b8be8b7e" },
744
+ {"id" : "faae1bd3-c848-41d6-b4dd-97d5b8be8b7e" }]}
745
+ req = fakes .HTTPRequest .blank ('/v2/os-aggregates' ,
746
+ use_admin_context = True ,
747
+ version = '2.81' )
748
+ self .assertRaises (exc .HTTPBadRequest , self .controller .images ,
749
+ req , '1' , body = body )
750
+
751
+ def test_images_with_disorder_id (self ):
752
+ body = {"cache" : [{"id" : "faae1bd3-c848-41d6-b4dd-97d5b8be8b7e" },
753
+ {"id" : "290de658-cf55-4cce-b025-9a1a9f93676a" },
754
+ {"id" : "896f7f54-4e4e-4c21-a2b7-47cff4e99ab0" },
755
+ {"id" : "d982bb82-04a0-4e9b-b40e-470f20a7b5d1" }]}
756
+ req = fakes .HTTPRequest .blank ('/v2/os-aggregates' ,
757
+ use_admin_context = True ,
758
+ version = '2.81' )
759
+ context = req .environ ['nova.context' ]
760
+ with mock .patch .object (self .controller .api ,
761
+ 'get_aggregate' ) as mock_get :
762
+ with mock .patch .object (self .controller .conductor_tasks ,
763
+ 'cache_images' ):
764
+ self .controller .images (req , '1' , body = body )
765
+ mock_get .assert_called_once_with (context , '1' )
0 commit comments