@@ -107,6 +107,28 @@ func TestCreateNewResourceGroup(t *testing.T) {
107
107
assert .DeepEqual (t , data , aciContext ("1234" , "newResourceGroup" , "eastus" ))
108
108
}
109
109
110
+ func TestCreateNewResourceGroupWithSpecificLocation (t * testing.T ) {
111
+ ctx := context .TODO ()
112
+ opts := options ("1234" , "" )
113
+ opts .Location = "eastus2"
114
+ m := testContextMocks ()
115
+ m .resourceGroupHelper .On ("GetSubscriptionIDs" , ctx ).Return ([]subscription.Model {subModel ("1234" , "Subscription1" )}, nil )
116
+ m .resourceGroupHelper .On ("GetGroup" , ctx , "1234" , "myResourceGroup" ).Return (group ("myResourceGroup" , "eastus" ), nil )
117
+
118
+ selectOptions := []string {"create a new resource group" , "group1 (eastus)" , "group2 (westeurope)" }
119
+ m .userPrompt .On ("Select" , "Select a resource group" , selectOptions ).Return (0 , nil )
120
+ m .resourceGroupHelper .On ("CreateOrUpdate" , ctx , "1234" , mock .AnythingOfType ("string" ), mock .AnythingOfType ("resources.Group" )).Return (group ("newResourceGroup" , "eastus" ), nil )
121
+ m .resourceGroupHelper .On ("ListGroups" , ctx , "1234" ).Return ([]resources.Group {
122
+ group ("group1" , "eastus" ),
123
+ group ("group2" , "westeurope" ),
124
+ }, nil )
125
+
126
+ data , description , err := m .contextCreateHelper .createContextData (ctx , opts )
127
+ assert .NilError (t , err )
128
+ assert .Equal (t , description , "newResourceGroup@eastus2" )
129
+ assert .DeepEqual (t , data , aciContext ("1234" , "newResourceGroup" , "eastus2" ))
130
+ }
131
+
110
132
func TestSelectExistingResourceGroup (t * testing.T ) {
111
133
ctx := context .TODO ()
112
134
opts := options ("1234" , "" )
@@ -194,7 +216,6 @@ func options(subscriptionID string, resourceGroupName string) ContextParams {
194
216
return ContextParams {
195
217
SubscriptionID : subscriptionID ,
196
218
ResourceGroup : resourceGroupName ,
197
- Location : "eastus" ,
198
219
}
199
220
}
200
221
0 commit comments