Skip to content

Commit

Permalink
tests: refactor some tests to use webtest
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Jan 24, 2024
1 parent db3b316 commit e53e193
Showing 1 changed file with 21 additions and 50 deletions.
71 changes: 21 additions & 50 deletions web/tests/meeting/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,17 @@ def test_join_meeting_as_authenticated_attendee(
assert "/meeting/wait/1/creator/1/hash/" in response.location
assert "Bob%20Dylan" in response.location

response = response.follow()

assert response.form["fullname"].value == "Bob Dylan"


def test_join_meeting_as_authenticated_attendee_with_fullname_suffix(
client_app, meeting, authenticated_attendee, bbb_response
):
meeting_hash = meeting.get_hash("authenticated")

response = client_app.post(
"/meeting/join",
{
"fullname": "Bob Dylan",
"meeting_fake_id": meeting.id,
"user_id": meeting.user.id,
"h": meeting_hash,
"fullname_suffix": "Service",
},
status=302,
)
response = client_app.get(f"/meeting/join/{meeting.id}/authenticated").follow()
response.form["fullname_suffix"] = "Service"
response = response.form.submit(status=302)

assert (
f"{client_app.app.config['BIGBLUEBUTTON_ENDPOINT']}/join?fullName=Bob+Dylan+-+Service&"
Expand All @@ -107,18 +101,9 @@ def test_join_meeting_as_authenticated_attendee_with_fullname_suffix(
def test_join_meeting_as_authenticated_attendee_with_modified_fullname(
client_app, meeting, authenticated_attendee, bbb_response
):
meeting_hash = meeting.get_hash("authenticated")

response = client_app.post(
"/meeting/join",
{
"fullname": "toto",
"meeting_fake_id": meeting.id,
"user_id": meeting.user.id,
"h": meeting_hash,
"fullname_suffix": "",
},
)
response = client_app.get(f"/meeting/join/{meeting.id}/authenticated").follow()
response.form["fullname"] = "toto"
response = response.form.submit()

assert (
f"{client_app.app.config['BIGBLUEBUTTON_ENDPOINT']}/join?fullName=Bob+Dylan&"
Expand All @@ -129,21 +114,14 @@ def test_join_meeting_as_authenticated_attendee_with_modified_fullname(

def test_join_meeting(client_app, meeting, bbb_response):
meeting_hash = meeting.get_hash("attendee")
fullname = "Bob"

response = client_app.post(
"/meeting/join",
{
"fullname": fullname,
"meeting_fake_id": meeting.id,
"user_id": meeting.user.id,
"h": meeting_hash,
},
status=302,
response = client_app.get(
f"/meeting/signin/{meeting.id}/creator/{meeting.user.id}/hash/{meeting_hash}"
)
response.form["fullname"] = "Bob"
response = response.form.submit()

assert (
f"{client_app.app.config['BIGBLUEBUTTON_ENDPOINT']}/join?fullName={fullname}"
f"{client_app.app.config['BIGBLUEBUTTON_ENDPOINT']}/join?fullName=Bob"
in response.location
)
assert "guest" in response.location
Expand All @@ -152,22 +130,15 @@ def test_join_meeting(client_app, meeting, bbb_response):
def test_join_mail_meeting(client_app, meeting, bbb_response):
expiration = int(time.time()) + 1000
meeting_hash = meeting.get_mail_signin_hash(meeting.id, expiration)
fullname = "Bob"

response = client_app.post(
"/meeting/joinmail",
{
"fullname": fullname,
"meeting_fake_id": meeting.id,
"user_id": meeting.user.id,
"h": meeting_hash,
"expiration": expiration,
},
status=302,
response = client_app.get(
f"/meeting/signinmail/{meeting.id}/expiration/{expiration}/hash/{meeting_hash}"
)
response.form["fullname"] = "Bob"
response.form["user_id"] = meeting.user.id
response = response.form.submit()

assert (
f"{client_app.app.config['BIGBLUEBUTTON_ENDPOINT']}/join?fullName={fullname}"
f"{client_app.app.config['BIGBLUEBUTTON_ENDPOINT']}/join?fullName=Bob"
in response.location
)

Expand Down

0 comments on commit e53e193

Please sign in to comment.