django-selenium-login: Quick Selenium login for Django
django-selenium-login sets a session cookie for the Selenium driver and a creates a session object for the Django backend in order to force a user to quickly login.
Usage
With django-selenium-login you can use the force_login function to force a user to qucikly login before using the the Selenium driver to proceeds on pages that requires login. The function takes a Django user, a Selenium driver, and the base url for the live server. Here is an example of how to use the force_login function in a test:
from seleniumlogin import force_login
def test_use_django_selenium_login_to_force_login(selenium, live_server):
User = get_user_model()
user = User.objects.create_user(username='myuser', password='password')
force_login(user, selenium, live_server.url)
selenium.get('{}/a/url/which/requires/login/'.format(live_server.url))
Before setting the session cookie for the Selenium driver, the driver must access a page in the project. By default it will try to access the /page_404/ page. This can be changed by changing the SELENIUM_LOGIN_START_PAGE setting in the settings file for your tests. A blank page is used for the tests in this lib.
Installation
Use pip to install django-selenium-login:
pip install django-selenium-login
For developers
Create venv using:
make venv
Run tests for multiple versions of Python and Django for a specific browser using tox:
tox -- --driver=Chrome
Use environment variable SESSION_ENGINE to change authentication backend.
To run tests for all authentication backends for Chrome and Firefox:
./run_tests.sh
To run tests in docker with selenium server and headless chrome in a continer:
make run-tests-in-docker
Metadata
Release files for django-selenium-login 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-selenium-login-2.0.0.tar.gz | 3.3 kB | Without provenance | Details for django-selenium-login-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_selenium_login-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for django_selenium_login-2.0.0-py3-none-any.whl |
Total release size: 8.6 kB
Release files / django-selenium-login-2.0.0.tar.gz
| Download URL | django-selenium-login-2.0.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95ac04f34ef3f922a03bd5751460674a6b110b426f1c5a7a60da227194fde247
|
|
BLAKE2b-256 checksum How to use checksums |
c6feab8d8ccb531ca694dc607bf99f36dbeaef5eabbd495a5e0017ba0d125762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Release files / django_selenium_login-2.0.0-py3-none-any.whl
| Download URL | django_selenium_login-2.0.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3fafc13a46ea24bb0efcedd07e03527408e60ce0e965d5bbeedb7e2fd153f59
|
|
BLAKE2b-256 checksum How to use checksums |
d75e25e0137375308ce3ba8374ce31f9daeb1b50524a6bbe7db444b72aab5bc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Security for django-selenium-login 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.