Skip to content

Commit

Permalink
Add status endpoint test
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikWin committed Jan 10, 2025
1 parent 8960fad commit 0aa5625
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: cargo build
- name: Build Release
run: cargo build --release
- name: Run vidformer tests
- name: Run vidformer Rust tests
run: cargo test --verbose
timeout-minutes: 5
- name: Install vidformer-py
Expand Down
35 changes: 35 additions & 0 deletions viper-den/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,41 @@ def test_terminate_delayed():
assert spec["terminated"]


def test_status_endpoint():
spec_id = _create_example_spec()

status_url = f"{ENDPOINT}vod/{spec_id}/status"
response = requests.get(status_url)
response.raise_for_status()
response = response.json()
assert response["closed"] == False
assert response["terminated"] == False
assert response["ready"] == False

# Push 60 frames (enough for 1 segment)
source_id = _create_tos_source()
ts = [[i, 30] for i in range(60)]
_push_frames(spec_id, source_id, ts, 0, False)

response = requests.get(status_url)
response.raise_for_status()
response = response.json()
assert response["closed"] == False
assert response["terminated"] == False
assert response["ready"] == True

# Terminate
ts = []
_push_frames(spec_id, source_id, ts, 60, True)

response = requests.get(status_url)
response.raise_for_status()
response = response.json()
assert response["closed"] == False
assert response["terminated"] == True
assert response["ready"] == True


def test_empty_playlist_endpoint():
spec_id = _create_example_spec()
spec = _get_spec(spec_id)
Expand Down

0 comments on commit 0aa5625

Please sign in to comment.