Best Python code snippet using tempest_python
test_account.py
Source:test_account.py
1import pytest2from settings import PASSWORD, USERNAME3from tmdb import account4from tmdb.models.media import MediaRequestObject5def test_create_request_token():6 token = account.create_request_token()7 assert token is not None8def test_authenticate_token(create_token):9 authenticated_token = account.authorize_request_token_with_login(create_token, USERNAME, PASSWORD)10 assert authenticated_token is not None11INVALID_LOGIN_CREDS = [12 {"username": "bad username", "password": PASSWORD, "request_token": None},13 {"username": USERNAME, "password": "bad password", "request_token": None},14 {"username": USERNAME, "password": PASSWORD, "request_token": "bad token"},15]16@pytest.mark.parametrize("payload", INVALID_LOGIN_CREDS)17def test_cannot_auth_token_with_invalid_inputs(payload):18 with pytest.raises(ValueError):19 account.authorize_request_token_with_login(**payload)...
test_authentication.py
Source:test_authentication.py
...4@polite5def test_create_guest_session(tmdb):6 assert tmdb.create_guest_session() is not None7@polite8def test_create_request_token(tmdb):9 assert tmdb.create_request_token() is not None10@polite11def test_session_workflow_with_login(tmdb):12 username = os.getenv("username")13 password = os.getenv("password")14 request_token = tmdb.create_request_token().get("request_token")15 assert username and password and request_token16 assert tmdb.create_session_with_login(username, password, request_token)17 session_id = tmdb.create_session(request_token).get("session_id")18 assert tmdb.delete_session(session_id) is not None19@polite20def test_create_session_from_v4_access_token(tmdb):21 with pytest.raises(NotImplementedError):22 assert tmdb.create_session_from_v4_access_token()
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!