82
82
+ "" .join (random .choices (string .ascii_letters , k = 8 )),
83
83
"type" : "Satellite" ,
84
84
"version" : f"{ MANIFEST_DATA ['sat_version' ]} " ,
85
- "entitlementQuantity" : sum (d ["quantity" ] for d in MANIFEST_DATA ["subscription_data" ]),
86
- "url" : f"{ MANIFEST_DATA ['url' ]['allocations' ]} /{ SUB_ALLOCATION_UUID } " ,
85
+ "entitlementsAttachedQuantity" : sum (
86
+ d ["quantity" ] for d in MANIFEST_DATA ["subscription_data" ]
87
+ ),
87
88
"simpleContentAccess" : f"{ MANIFEST_DATA ['simple_content_access' ]} " ,
88
89
}
89
- ]
90
+ ],
91
+ "status_code" : 200 ,
90
92
}
91
93
92
94
@@ -148,9 +150,9 @@ def get(self, *args, **kwargs):
148
150
self .pool_response ["body" ] += SUB_POOL_RESPONSE ["body" ]
149
151
return self
150
152
if args [0 ].endswith ("allocations" ) and self ._has_offset :
151
- if kwargs ["params" ]["offset" ] != 50 :
153
+ if kwargs ["params" ]["offset" ] != 100 :
152
154
self .allocations_response = {"body" : []}
153
- for _x in range (50 ):
155
+ for _x in range (100 ):
154
156
self .allocations_response ["body" ].append (
155
157
{
156
158
"uuid" : f"{ uuid .uuid4 ().hex } " ,
@@ -197,6 +199,15 @@ def delete(self, *args, **kwargs):
197
199
self ._good_codes = [204 ]
198
200
return self
199
201
202
+ def __repr__ (self ):
203
+ """Return a string representation of the RhsmApiStub instance."""
204
+ inner = ", " .join (
205
+ f"{ k } ={ v } "
206
+ for k , v in self .__dict__ .items ()
207
+ if not k .startswith ("_" ) and not callable (v )
208
+ )
209
+ return f"{ self .__class__ .__name__ } ({ inner } )"
210
+
200
211
201
212
def test_basic_init ():
202
213
"""Test that manifester can initialize with the minimum required arguments."""
@@ -211,7 +222,7 @@ def test_create_allocation():
211
222
"""Test that manifester's create_subscription_allocation method returns a UUID."""
212
223
manifester = Manifester (manifest_category = MANIFEST_DATA , requester = RhsmApiStub (in_dict = None ))
213
224
allocation_uuid = manifester .create_subscription_allocation ()
214
- assert allocation_uuid . uuid == SUB_ALLOCATION_UUID
225
+ assert allocation_uuid == SUB_ALLOCATION_UUID
215
226
216
227
217
228
def test_negative_simple_retry_timeout ():
@@ -300,7 +311,7 @@ def test_invalid_sat_version():
300
311
def test_update_inventory ():
301
312
"""Test that inventory file is populated with expected contents after updating."""
302
313
manifester = Manifester (manifest_category = MANIFEST_DATA , requester = RhsmApiStub (in_dict = None ))
303
- update_inventory (manifester .subscription_allocations )
314
+ update_inventory (manifester .subscription_allocations , sync = True , uuid = SUB_ALLOCATION_UUID )
304
315
assert (
305
316
load_inventory_file (Path (MANIFEST_DATA ["inventory_path" ]))
306
317
== SUB_ALLOCATIONS_RESPONSE ["body" ]
0 commit comments