Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
osbre committed Jun 8, 2024
1 parent e16fad5 commit 86df7d0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_streampot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}/"
Expand All @@ -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):
Expand Down

0 comments on commit 86df7d0

Please sign in to comment.