@@ -145,6 +145,34 @@ def ansible_catalog_item(appliance, ansible_repository):
145
145
cat_item .delete_if_exists ()
146
146
147
147
148
+ @pytest .fixture (scope = "function" )
149
+ def ansible_catalog_item_funcscope (appliance , ansible_repository ):
150
+ collection = appliance .collections .catalog_items
151
+ cat_item = collection .create (
152
+ collection .ANSIBLE_PLAYBOOK ,
153
+ fauxfactory .gen_alphanumeric (),
154
+ fauxfactory .gen_alphanumeric (),
155
+ display_in_catalog = True ,
156
+ provisioning = {
157
+ "repository" : ansible_repository .name ,
158
+ "playbook" : "dump_all_variables.yml" ,
159
+ "machine_credential" : "CFME Default Credential" ,
160
+ "create_new" : True ,
161
+ "provisioning_dialog_name" : fauxfactory .gen_alphanumeric (),
162
+ "extra_vars" : [("some_var" , "some_value" )]
163
+ },
164
+ retirement = {
165
+ "repository" : ansible_repository .name ,
166
+ "playbook" : "dump_all_variables.yml" ,
167
+ "machine_credential" : "CFME Default Credential" ,
168
+ "extra_vars" : [("some_var" , "some_value" )]
169
+ }
170
+ )
171
+ yield cat_item
172
+
173
+ cat_item .delete_if_exists ()
174
+
175
+
148
176
@pytest .fixture (scope = "module" )
149
177
def ansible_catalog (appliance , ansible_catalog_item ):
150
178
catalog = appliance .collections .catalogs .create (fauxfactory .gen_alphanumeric (),
@@ -165,8 +193,9 @@ def ansible_service_catalog(appliance, ansible_catalog_item, ansible_catalog):
165
193
166
194
167
195
@pytest .fixture (scope = "function" )
168
- def ansible_service_request_funcscope (appliance , ansible_catalog_item ):
169
- request_descr = "Provisioning Service [{0}] from [{0}]" .format (ansible_catalog_item .name )
196
+ def ansible_service_request_funcscope (appliance , ansible_catalog_item_funcscope ):
197
+ request_descr = (f"Provisioning Service [{ ansible_catalog_item_funcscope } ]"
198
+ "from [{ansible_catalog_item_funcscope}]" )
170
199
service_request = appliance .collections .requests .instantiate (description = request_descr )
171
200
yield service_request
172
201
@@ -176,8 +205,8 @@ def ansible_service_request_funcscope(appliance, ansible_catalog_item):
176
205
177
206
178
207
@pytest .fixture (scope = "function" )
179
- def ansible_service_funcscope (appliance , ansible_catalog_item ):
180
- service = MyService (appliance , ansible_catalog_item .name )
208
+ def ansible_service_funcscope (appliance , ansible_catalog_item_funcscope ):
209
+ service = MyService (appliance , ansible_catalog_item_funcscope .name )
181
210
yield service
182
211
183
212
if service .exists :
0 commit comments