Handle empty recording days and stale playback queries
This commit is contained in:
+13
@@ -1,6 +1,7 @@
|
||||
"""Isolated regression tests: python -m unittest -v test_app."""
|
||||
import hashlib
|
||||
import http.client
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
@@ -128,6 +129,18 @@ class WebTests(unittest.TestCase):
|
||||
self.assertIn('h264_vaapi', command)
|
||||
self.assertIn('pipe:1', command)
|
||||
|
||||
def test_empty_recording_day_is_not_service_failure(self):
|
||||
error = app.urllib.error.HTTPError('http://localhost/list', 404, 'Not Found', {},
|
||||
io.BytesIO(b'{"error":"no recording segments found"}'))
|
||||
with patch('app.urllib.request.urlopen', side_effect=error):
|
||||
self.assertEqual(app.media_json('/list?path=example', playback=True), [])
|
||||
|
||||
def test_real_media_service_error_is_preserved(self):
|
||||
error = app.urllib.error.HTTPError('http://localhost/list', 500, 'Error', {}, io.BytesIO(b'{}'))
|
||||
with patch('app.urllib.request.urlopen', side_effect=error):
|
||||
with self.assertRaises(app.Problem):
|
||||
app.media_json('/list?path=example', playback=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user