def test_overwrite(self, hls_server, monkeypatch): monkeypatch.setattr(sys, "argv", ["-", hls_server.good_playlist]) assert caterpillar.main() == 0 assert caterpillar.main() == 1 monkeypatch.setattr(sys, "argv", ["-", "-f", hls_server.good_playlist]) assert caterpillar.main() == 0 assert os.path.isfile("good.mp4") assert not os.path.exists("good")
def test_variant_streams(self, hls_server, monkeypatch): monkeypatch.setattr( sys, "argv", ["-", hls_server.variants_playlist, "variant.mp4"] ) assert caterpillar.main() == 0 assert os.path.isfile("variant.mp4") # Make sure the 720p variant is the one downloaded, not the 480p one. assert re.search(r"Video:.*1280x720", probe("variant.mp4"))
def test_empty_playlist(self, hls_server, monkeypatch): monkeypatch.setattr(sys, "argv", ["-", hls_server.empty_playlist]) assert caterpillar.main() == 1 assert os.path.isdir("empty") assert not os.path.isfile("empty.mp4")
def test_keep(self, hls_server, monkeypatch): monkeypatch.setattr(sys, "argv", ["-", "-k", hls_server.good_playlist]) assert caterpillar.main() == 0 assert os.path.isfile("good.mp4") assert os.path.isdir("good")
def try_extention(ext): output = f"good.{ext}" monkeypatch.setattr(sys, "argv", ["-", "-m", mode, playlist, output]) assert caterpillar.main() == 0 assert os.path.isfile(output)
def test_output_file(self, hls_server, monkeypatch): monkeypatch.setattr(sys, "argv", ["-", hls_server.good_playlist, "good.ts"]) assert caterpillar.main() == 0 assert os.path.isfile("good.ts") assert not os.path.exists("good")
def test_containers(self, hls_server, monkeypatch): monkeypatch.setattr(sys, "argv", ["-", hls_server.good_playlist, "good.flv"]) assert caterpillar.main() == 0 assert os.path.isfile("good.flv")