Skip to main content

pytest plugin for Firefox Accounts

Project description


pytest-fxa is a plugin for pytest_ that provides test accounts for
`Firefox Accounts`_.

.. image::
:alt: License
.. image::
:alt: PyPI
.. image::
:alt: Travis
.. image::
:alt: Issues
.. image::
:alt: Updates
.. image::
:alt: Python 3


You will need the following prerequisites in order to use pytest-fxa:

- Python 2.7, 3.6, PyPy, or PyPy3


To install pytest-fxa:

.. code-block:: bash

$ pip install pytest-fxa

Creating a test Firefox Account

To create a Firefox Account for testing, include the ``fxa_account`` fixture
name in your test method signature. This is a tuple with named properties for
the test account's ``email`` and ``password``. The following example shows how
this could be used with `Selenium`_ to sign into a website that uses Firefox
Accounts for authentication:

.. code-block:: python

def test_my_fxa_site(fxa_account, selenium):
selenium.find_element(By.ID, 'email').send_keys(
selenium.find_element(By.ID, 'password').send_keys(fxa_account.password)
selenium.find_element(By.ID, 'login').click()

The test account will be automatically destroyed when it's no longer needed.

Specifying an environment

By default all accounts will be created on the 'stage' environment. You can set
the ``FXA_ENV`` environment variable to target 'production' or 'stable'.
Alternatively, you can override the ``fxa_urls`` fixture to specify the URL for
you environment:

.. code-block:: python

def fxa_urls():
return {
'authentication': '',
'oauth': '',
'content': '',
'profile': '',
'token': ''}


- `Release Notes`_
- `Issue Tracker`_
- Code_

.. _pytest:
.. _Firefox Accounts:
.. _Release Notes:
.. _Issue Tracker:
.. _Code:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-fxa, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pytest_fxa-1.0.0-py2.py3-none-any.whl (3.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size pytest-fxa-1.0.0.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page