From 86df7d04272e24b31d0a0d9413a0871df6448d6a Mon Sep 17 00:00:00 2001 From: Ostap Brehin Date: Sat, 8 Jun 2024 02:16:33 +0100 Subject: [PATCH] Fix tests --- tests/test_streampot.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/test_streampot.py b/tests/test_streampot.py index d4c750a..947043b 100644 --- a/tests/test_streampot.py +++ b/tests/test_streampot.py @@ -2,26 +2,30 @@ import requests_mock from streampot import StreamPot, JobEntity, JobStatus + @pytest.fixture def stream_pot(): return StreamPot(secret='test_secret') + def test_initialization(stream_pot): assert stream_pot.secret == 'test_secret' assert stream_pot.base_url == 'https://api.streampot.io/v1' assert isinstance(stream_pot.actions, list) assert len(stream_pot.actions) == 0 -def test_check_status(stream_pot): + +def test_get_job(stream_pot): with requests_mock.Mocker() as m: - job_id = '123' + job_id = 123 mock_url = f"{stream_pot.base_url}/jobs/{job_id}" mock_response = {'id': 123, 'status': 'completed', 'created_at': '2020-01-01'} m.get(mock_url, json=mock_response) - response = stream_pot.check_status(job_id) + response = stream_pot.get_job(job_id) assert response == mock_response + def test_run(stream_pot): with requests_mock.Mocker() as m: mock_url = f"{stream_pot.base_url}/" @@ -34,15 +38,17 @@ def test_run(stream_pot): assert response.status == JobStatus.PENDING assert response.created_at == '2020-01-02' + def test_add_action(stream_pot): stream_pot.merge_add('source_video.mp4') assert len(stream_pot.actions) == 1 assert stream_pot.actions[0]['name'] == 'mergeAdd' assert stream_pot.actions[0]['value'] == ('source_video.mp4',) + @pytest.mark.parametrize("method, expected_action", [ ("merge_add", 'mergeAdd'), - # ("add_input", 'addInput'), + ("add_input", 'addInput'), # add more methods and expected actions as necessary ]) def test_actions(stream_pot, method, expected_action):