|
|
@ -23,8 +23,10 @@ Episode1 = {} |
|
|
|
) as videoFile: |
|
|
|
auto = autoupload.AutoUpload(videoFile.filename) |
|
|
|
|
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/Episode1.mp4") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/Episode1.mp4") |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/Episode1.mp4") |
|
|
|
nextVideo = auto.nextVideo(self.platform2) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/Episode1.mp4") |
|
|
|
|
|
|
|
def test_nextVideoSubfolder(self): |
|
|
|
with TestFileContent( |
|
|
@ -34,8 +36,10 @@ Episode1 = {} |
|
|
|
) as videoFile: |
|
|
|
auto = autoupload.AutoUpload(videoFile.filename) |
|
|
|
|
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/subfolder/Episode1.mp4") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/subfolder/Episode1.mp4") |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/subfolder/Episode1.mp4") |
|
|
|
nextVideo = auto.nextVideo(self.platform2) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/subfolder/Episode1.mp4") |
|
|
|
|
|
|
|
def test_success(self): |
|
|
|
with TestFileContent( |
|
|
@ -45,10 +49,13 @@ Episode1 = {} |
|
|
|
) as videoFile: |
|
|
|
auto = autoupload.AutoUpload(videoFile.filename) |
|
|
|
|
|
|
|
auto.nextVideo(self.platform1) |
|
|
|
auto.success(self.platform1, "https://platform/url", datetime(2020, 8, 28, 17, 54, 31)) |
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), False) |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/Episode1.mp4") |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
nextVideo.success("https://platform/url", datetime(2020, 8, 28, 17, 54, 31)) |
|
|
|
|
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
self.assertEqual(nextVideo, None) |
|
|
|
nextVideo = auto.nextVideo(self.platform2) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/Episode1.mp4") |
|
|
|
# TODO: read file and check formatting and content? |
|
|
|
|
|
|
|
# print("content of file") |
|
|
@ -63,10 +70,11 @@ Episode1 = {} |
|
|
|
) as videoFile: |
|
|
|
auto = autoupload.AutoUpload(videoFile.filename) |
|
|
|
|
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/Episode1.mp4") |
|
|
|
auto.error(self.platform1, "https://platform/url") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/Episode1.mp4") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/Episode1.mp4") |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
nextVideo.error("Server not available") |
|
|
|
|
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/Episode1.mp4") |
|
|
|
# TODO: read file and check formatting and content? |
|
|
|
|
|
|
|
# print("content of file") |
|
|
@ -81,28 +89,31 @@ Episode1 = {} |
|
|
|
) as videoFile: |
|
|
|
auto = autoupload.AutoUpload(videoFile.filename) |
|
|
|
|
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/Episode1.mp4") |
|
|
|
auto.error(self.platform1, "https://platform/url") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/Episode1.mp4") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/Episode1.mp4") |
|
|
|
# TODO: read file and check formatting and content? |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
nextVideo.error("Server not available") |
|
|
|
|
|
|
|
print("content of file") |
|
|
|
with open(videoFile.filename, "r") as file: |
|
|
|
print(file.readlines()) |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
# TODO: read file and check formatting and content? |
|
|
|
|
|
|
|
# print("content of file") |
|
|
|
# with open(videoFile.filename, "r") as file: |
|
|
|
# print(file.readlines()) |
|
|
|
|
|
|
|
auto.success(self.platform1, "https://platform/url", datetime(2020, 8, 28, 17, 54, 31)) |
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), False) |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/Episode1.mp4") |
|
|
|
nextVideo.success("https://platform/url", datetime(2020, 8, 28, 17, 54, 31)) |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
self.assertEqual(nextVideo, None) |
|
|
|
nextVideo = auto.nextVideo(self.platform2) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/Episode1.mp4") |
|
|
|
# TODO: read file and check formatting and content? |
|
|
|
# TODO: check the key "platform-error" is not present after a success |
|
|
|
|
|
|
|
print("content of file") |
|
|
|
with open(videoFile.filename, "r") as file: |
|
|
|
print(file.readlines()) |
|
|
|
# print("content of file") |
|
|
|
# with open(videoFile.filename, "r") as file: |
|
|
|
# print(file.readlines()) |
|
|
|
|
|
|
|
def test_subAutouploadFile(self): |
|
|
|
# We may split this test to first test that we can have reference another file |
|
|
|
# and then that we pass transparently between files. |
|
|
|
with TestFileContent( |
|
|
|
"""[videos] |
|
|
|
Episode2 = {} # TODO: We should chek that the path of this file is from the base path of this autoupload config file |
|
|
@ -117,12 +128,27 @@ Episode1 = {{}} # Double curly braces to escape them for f-string |
|
|
|
) as videoFile: |
|
|
|
auto = autoupload.AutoUpload(videoFile.filename) |
|
|
|
|
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/Episode1.mp4") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/Episode1.mp4") |
|
|
|
auto.success(self.platform1, "https://platform/url", datetime(2020, 8, 28, 17, 54, 31)) |
|
|
|
self.assertEqual(auto.nextVideo(self.platform1), "/tmp/Episode2.mp4") |
|
|
|
self.assertEqual(auto.nextVideo(self.platform2), "/tmp/Episode1.mp4") |
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
nextVideo.success("https://platform/url", datetime(2020, 8, 28, 17, 54, 31)) |
|
|
|
|
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/Episode2.mp4") |
|
|
|
# TODO: read file and check formatting and content? |
|
|
|
nextVideo.success("https://platform/url", datetime(2020, 8, 28, 17, 54, 31)) |
|
|
|
|
|
|
|
nextVideo = auto.nextVideo(self.platform1) |
|
|
|
self.assertEqual(nextVideo, None) |
|
|
|
nextVideo = auto.nextVideo(self.platform2) |
|
|
|
self.assertEqual(nextVideo.videoPath, "/tmp/Episode1.mp4") |
|
|
|
# TODO: read file and check formatting and content? |
|
|
|
|
|
|
|
# print("content of autoupload file") |
|
|
|
# with open(autouploadFile.filename, "r") as file: |
|
|
|
# print(file.readlines()) |
|
|
|
# |
|
|
|
# print("content of video file") |
|
|
|
# with open(videoFile.filename, "r") as file: |
|
|
|
# print(file.readlines()) |
|
|
|
|
|
|
|
# https://stackoverflow.com/a/54053967 |
|
|
|
class TestFileContent: |
|
|
|