Skip to content

Commit

Permalink
[feat] add sessions test
Browse files Browse the repository at this point in the history
  • Loading branch information
erik1110 committed Sep 16, 2023
1 parent 036fc21 commit b1582ce
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/ccip/tests/api/test_ccip.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,22 @@ def test_data_structure(client):
assert_data_structure(data, 'session_types')
assert_data_structure(data, 'tags')
assert_data_structure(data, 'rooms')

@pytest.mark.django_db
def test_session(client):
response = client.get(endpoint, follow=True)
data = response.json()
assert 'sessions' in data
sessions = data.get('sessions', [])
# 檢查每個 session 是否包含所需的字段
required_fields = [
"id", "type", "start", "end", "slide", "speakers", "tags",
"en", "zh", "room", "broadcast", "qa", "live", "record"
]
for session in sessions:
for field in required_fields:
assert field in session
assert 'title' in session['en']
assert 'description' in session['en']
assert 'title' in session['zh']
assert 'description' in session['zh']

0 comments on commit b1582ce

Please sign in to comment.