Skip to content

Commit 7609504

Browse files
Fix tests/test_osupdate.py
1 parent fd4fda0 commit 7609504

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/test_osupdate.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ def setUp(self):
5555

5656
def test_get_update_url_waveshare(self):
5757
"""Test URL generation for waveshare hardware."""
58-
url = self.checker.get_update_url("waveshare-esp32-s3-touch-lcd-2")
58+
url = self.checker.get_update_url("waveshare_esp32_s3_touch_lcd_2")
5959

6060
self.assertEqual(url, "https://updates.micropythonos.com/osupdate.json")
6161

6262
def test_get_update_url_other_hardware(self):
6363
"""Test URL generation for other hardware."""
64-
url = self.checker.get_update_url("fri3d-2024")
64+
url = self.checker.get_update_url("fri3d_2024")
6565

66-
self.assertEqual(url, "https://updates.micropythonos.com/osupdate_fri3d-2024.json")
66+
self.assertEqual(url, "https://updates.micropythonos.com/osupdate_fri3d_2024.json")
6767

6868
def test_fetch_update_info_success(self):
6969
"""Test successful update info fetch."""
@@ -78,7 +78,7 @@ def test_fetch_update_info_success(self):
7878
text=json.dumps(update_data)
7979
)
8080

81-
result = self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
81+
result = self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
8282

8383
self.assertEqual(result["version"], "0.3.3")
8484
self.assertEqual(result["download_url"], "https://example.com/update.bin")
@@ -90,7 +90,7 @@ def test_fetch_update_info_http_error(self):
9090

9191
# MicroPython doesn't have ConnectionError, so catch generic Exception
9292
try:
93-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
93+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
9494
self.fail("Should have raised an exception for HTTP 404")
9595
except Exception as e:
9696
# Should be a ConnectionError, but we accept any exception with HTTP status
@@ -104,7 +104,7 @@ def test_fetch_update_info_invalid_json(self):
104104
)
105105

106106
with self.assertRaises(ValueError) as cm:
107-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
107+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
108108

109109
self.assertIn("Invalid JSON", str(cm.exception))
110110

@@ -117,7 +117,7 @@ def test_fetch_update_info_missing_version_field(self):
117117
)
118118

119119
with self.assertRaises(ValueError) as cm:
120-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
120+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
121121

122122
self.assertIn("missing required fields", str(cm.exception))
123123
self.assertIn("version", str(cm.exception))
@@ -131,7 +131,7 @@ def test_fetch_update_info_missing_download_url_field(self):
131131
)
132132

133133
with self.assertRaises(ValueError) as cm:
134-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
134+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
135135

136136
self.assertIn("download_url", str(cm.exception))
137137

@@ -158,7 +158,7 @@ def test_fetch_update_info_timeout(self):
158158
self.mock_requests.set_exception(Exception("Timeout"))
159159

160160
try:
161-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
161+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
162162
self.fail("Should have raised an exception for timeout")
163163
except Exception as e:
164164
self.assertIn("Timeout", str(e))
@@ -168,7 +168,7 @@ def test_fetch_update_info_connection_refused(self):
168168
self.mock_requests.set_exception(Exception("Connection refused"))
169169

170170
try:
171-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
171+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
172172
self.fail("Should have raised an exception")
173173
except Exception as e:
174174
self.assertIn("Connection refused", str(e))
@@ -178,7 +178,7 @@ def test_fetch_update_info_empty_response(self):
178178
self.mock_requests.set_next_response(status_code=200, text='')
179179

180180
try:
181-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
181+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
182182
self.fail("Should have raised an exception for empty response")
183183
except Exception:
184184
pass # Expected to fail
@@ -188,7 +188,7 @@ def test_fetch_update_info_server_error_500(self):
188188
self.mock_requests.set_next_response(status_code=500)
189189

190190
try:
191-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
191+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
192192
self.fail("Should have raised an exception for HTTP 500")
193193
except Exception as e:
194194
self.assertIn("500", str(e))
@@ -202,7 +202,7 @@ def test_fetch_update_info_missing_changelog(self):
202202
)
203203

204204
try:
205-
self.checker.fetch_update_info("waveshare-esp32-s3-touch-lcd-2")
205+
self.checker.fetch_update_info("waveshare_esp32_s3_touch_lcd_2")
206206
self.fail("Should have raised exception for missing changelog")
207207
except ValueError as e:
208208
self.assertIn("changelog", str(e))

0 commit comments

Comments
 (0)