@@ -185,11 +185,12 @@ def test_invalid_dcd_formats(self):
185
185
186
186
187
187
class TestDCDStringE2EIoT (TestCase ):
188
+ @patch ("builtins.open" )
188
189
@patch ("pathlib.Path.is_file" )
189
- @patch ("pathlib.Path.read_text" )
190
- def test_dcd_info_iot_path_all_fields (self , mock_read_text , mock_is_file ):
190
+ def test_dcd_info_iot_path_all_fields (self , mock_is_file , mock_open ):
191
191
mock_is_file .return_value = True
192
- mock_read_text .return_value = (
192
+ mock_file = mock_open .return_value .__enter__ .return_value
193
+ mock_file .read .return_value = (
193
194
"canonical-oem-carlsbad:element-v2-uc24:20241205.15:v2-uc24-x01"
194
195
)
195
196
@@ -203,13 +204,14 @@ def test_dcd_info_iot_path_all_fields(self, mock_read_text, mock_is_file):
203
204
"https://oem-share.canonical.com/partners/carlsbad/share/element-v2-uc24/20241205.15/carlsbad-element-v2-uc24-20241205.15.tar.xz" ,
204
205
)
205
206
207
+ @patch ("builtins.open" )
206
208
@patch ("pathlib.Path.is_file" )
207
- @patch ("pathlib.Path.read_text" )
208
209
def test_dcd_info_iot_path_no_additional_info (
209
- self , mock_read_text , mock_is_file
210
+ self , mock_is_file , mock_open
210
211
):
211
212
mock_is_file .return_value = True
212
- mock_read_text .return_value = (
213
+ mock_file = mock_open .return_value .__enter__ .return_value
214
+ mock_file .read .return_value = (
213
215
"canonical-oem-shiner:x8high35-som-pdk:20250507-1170:"
214
216
)
215
217
@@ -243,7 +245,3 @@ def test_dcd_info_iot_path_not_exists(
243
245
# Since iot dcd file is missing, this must be pc platform
244
246
self .assertEqual (info ["project" ], "pinktiger" )
245
247
self .assertEqual (info ["series" ], "noble" )
246
- self .assertEqual (
247
- info ["url" ],
248
- "https://oem-share.canonical.com/partners/pinktiger/share/releases/noble/oem-24.04a/20240823-74/" ,
249
- )
0 commit comments