jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1335064?usp=email )
Change subject: tests: Fix oversized upload offset test
......................................................................
tests: Fix oversized upload offset test
The test captured a stashed chunk but started a fresh upload without
passing its file key or oversized offset. Resume the stash explicitly so
the test reaches the intended local file-size validation.
Bug: T367317
Change-Id: I609ce6b01196901803a96cf94351c239e103f419
---
M tests/upload_tests.py
1 file changed, 10 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/upload_tests.py b/tests/upload_tests.py
index 7cd413a..b1957ee 100755
--- a/tests/upload_tests.py
+++ b/tests/upload_tests.py
@@ -466,13 +466,21 @@
)
self._verify_stash()
- @unittest.expectedFailure # T367317
def test_offset_oversize(self) -> None:
"""Test trying to continue with an offset which is to large."""
self._init_upload(1024)
self._offset = 2000
+ # Resume the captured stash instead of starting a fresh upload.
+ page = pywikibot.FilePage(self.site, 'MP_sounds-pwb.png')
+ uploader = Uploader(
+ self.site, page, source_filename=self.sounds_png,
+ comment='pywikibot test', text=page.text,
+ chunk_size=1024, ignore_warnings=True,
+ report_success=False)
with self.assertRaises(ValueError) as cm:
- self._finish_upload(1024, self.sounds_png)
+ uploader._upload(
+ ignore_warnings=True, report_success=False,
+ file_key=self._file_key, offset=self._offset)
self.assertEqual(
str(cm.exception),
f'For the file key "{self._file_key}" the offset was set to 2000'
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1335064?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I609ce6b01196901803a96cf94351c239e103f419
Gerrit-Change-Number: 1335064
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]