@ -20,6 +20,7 @@ from osc_lib import exceptions
from osc_lib import utils
from openstackclient . tests . unit . identity . v3 import fakes as project_fakes
from openstackclient . tests . unit import utils as tests_utils
from openstackclient . tests . unit . volume . v2 import fakes as volume_fakes
from openstackclient . volume . v2 import volume_snapshot
@ -107,27 +108,17 @@ class TestSnapshotCreate(TestSnapshot):
def test_snapshot_create_without_name ( self ) :
arglist = [
" --volume " , self . new_snapshot . volume_id ,
" --description " , self . new_snapshot . description ,
" --force "
]
verifylist = [
( " volume " , self . new_snapshot . volume_id ) ,
( " description " , self . new_snapshot . description ) ,
( " force " , True )
]
parsed_args = self . check_parser ( self . cmd , arglist , verifylist )
columns , data = self . cmd . take_action ( parsed_args )
self . snapshots_mock . create . assert_called_with (
self . new_snapshot . volume_id ,
force = True ,
name = None ,
description = self . new_snapshot . description ,
metadata = None ,
self . assertRaises (
tests_utils . ParserException ,
self . check_parser ,
self . cmd ,
arglist ,
verifylist ,
)
self . assertEqual ( self . columns , columns )
self . assertEqual ( self . data , data )
def test_snapshot_create_without_volume ( self ) :
arglist = [
@ -156,17 +147,19 @@ class TestSnapshotCreate(TestSnapshot):
self . assertEqual ( self . columns , columns )
self . assertEqual ( self . data , data )
def test_snapshot_create_with out _remote_source( self ) :
def test_snapshot_create_with _remote_source( self ) :
arglist = [
' --remote-source ' , ' source-name=test_source_name ' ,
' --remote-source ' , ' source-id=test_source_id ' ,
' --volume ' , self . new_snapshot . volume_id ,
self . new_snapshot . name ,
]
ref_dict = { ' source-name ' : ' test_source_name ' ,
' source-id ' : ' test_source_id ' }
verifylist = [
( ' remote_source ' , ref_dict ) ,
( ' volume ' , self . new_snapshot . volume_id ) ,
( " snapshot_name " , self . new_snapshot . name ) ,
]
parsed_args = self . check_parser ( self . cmd , arglist , verifylist )
@ -175,7 +168,7 @@ class TestSnapshotCreate(TestSnapshot):
self . snapshots_mock . manage . assert_called_with (
volume_id = self . new_snapshot . volume_id ,
ref = ref_dict ,
name = Non e,
name = self . new_snapshot . nam e,
description = None ,
metadata = None ,
)