pytest-fxa
==========
pytest-fxa is a plugin for pytest_ that provides test accounts for
`Firefox Accounts`_.
.. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg
:target: https://github.com/mozilla/pytest-fxa/blob/master/LICENSE
:alt: License
.. image:: https://img.shields.io/pypi/v/pytest-fxa.svg
:target: https://pypi.python.org/pypi/pytest-fxa/
:alt: PyPI
.. image:: https://img.shields.io/travis/mozilla/pytest-fxa.svg
:target: https://travis-ci.org/mozilla/pytest-fxa/
:alt: Travis
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
.. image:: https://img.shields.io/github/issues-raw/mozilla/pytest-fxa.svg
:target: https://github.com/mozilla/pytest-fxa/issues
:alt: Issues
.. image:: https://api.dependabot.com/badges/status?host=github&repo=mozilla/pytest-fxa
:target: https://dependabot.com
:alt: Dependabot
Requirements
------------
You will need the following prerequisites in order to use pytest-fxa:
- Python 2.7, 3.6, 3.7, PyPy, or PyPy3
Installation
------------
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.get('https://example.com/')
selenium.find_element(By.ID, 'email').send_keys(fxa_account.email)
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'.
If you need to override the environment for a subset of tests, or run tests against multiple environments, you can use the ``fxa_env`` marker:
.. code-block:: python
@pytest.mark.fxa_env('production')
def test_production(fxa_account):
selenium.get('https://example.com/')
selenium.find_element(By.ID, 'email').send_keys(fxa_account.email)
selenium.find_element(By.ID, 'password').send_keys(fxa_account.password)
selenium.find_element(By.ID, 'login').click()
@pytest.mark.fxa_env('stage', 'stable')
def test_stage(fxa_account):
selenium.get('https://elpmaxe.com/')
selenium.find_element(By.ID, 'email').send_keys(fxa_account.email)
selenium.find_element(By.ID, 'password').send_keys(fxa_account.password)
selenium.find_element(By.ID, 'login').click()
Alternatively, you can override the ``fxa_urls`` fixture for full control of
the URLs for your environment:
.. code-block:: python
@pytest.fixture
def fxa_urls():
return {
'authentication': 'https://api-accounts.stage.mozaws.net/v1',
'oauth': 'https://oauth.stage.mozaws.net/v1',
'content': 'https://accounts.stage.mozaws.net/',
'profile': 'https://profile.stage.mozaws.net/v1',
'token': 'https://token.stage.mozaws.net/'}
Resources
---------
- `Release Notes`_
- `Issue Tracker`_
- Code_
.. _pytest: http://www.python.org/
.. _Firefox Accounts: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Firefox_Accounts
.. _Selenium: https://www.seleniumhq.org/
.. _Release Notes: http://github.com/mozilla/pytest-fxa/blob/master/CHANGES.rst
.. _Issue Tracker: http://github.com/mozilla/pytest-fxa/issues
.. _Code: http://github.com/mozilla/pytest-fxa
Raw data
{
"_id": null,
"home_page": "https://github.com/clarmso/pytest-fxa",
"name": "pytest-fxa-mte",
"maintainer": "Clare So",
"docs_url": null,
"requires_python": null,
"maintainer_email": "cso@mozilla.com",
"keywords": "py.test pytest mozilla automation firefox account fxa",
"author": "Dave Hunt",
"author_email": "dhunt@mozilla.com",
"download_url": "https://files.pythonhosted.org/packages/13/1d/5c39c4ca91b81bbe36297479e6cee6ab5361da592bebbb2664d34b349c2b/pytest_fxa_mte-1.6.0.tar.gz",
"platform": null,
"description": "pytest-fxa\n==========\n\npytest-fxa is a plugin for pytest_ that provides test accounts for\n`Firefox Accounts`_.\n\n.. image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg\n :target: https://github.com/mozilla/pytest-fxa/blob/master/LICENSE\n :alt: License\n.. image:: https://img.shields.io/pypi/v/pytest-fxa.svg\n :target: https://pypi.python.org/pypi/pytest-fxa/\n :alt: PyPI\n.. image:: https://img.shields.io/travis/mozilla/pytest-fxa.svg\n :target: https://travis-ci.org/mozilla/pytest-fxa/\n :alt: Travis\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/ambv/black\n.. image:: https://img.shields.io/github/issues-raw/mozilla/pytest-fxa.svg\n :target: https://github.com/mozilla/pytest-fxa/issues\n :alt: Issues\n.. image:: https://api.dependabot.com/badges/status?host=github&repo=mozilla/pytest-fxa\n :target: https://dependabot.com\n :alt: Dependabot\n\nRequirements\n------------\n\nYou will need the following prerequisites in order to use pytest-fxa:\n\n- Python 2.7, 3.6, 3.7, PyPy, or PyPy3\n\nInstallation\n------------\n\nTo install pytest-fxa:\n\n.. code-block:: bash\n\n $ pip install pytest-fxa\n\nCreating a test Firefox Account\n-------------------------------\n\nTo create a Firefox Account for testing, include the ``fxa_account`` fixture\nname in your test method signature. This is a tuple with named properties for\nthe test account's ``email`` and ``password``. The following example shows how\nthis could be used with `Selenium`_ to sign into a website that uses Firefox\nAccounts for authentication:\n\n.. code-block:: python\n\n def test_my_fxa_site(fxa_account, selenium):\n selenium.get('https://example.com/')\n selenium.find_element(By.ID, 'email').send_keys(fxa_account.email)\n selenium.find_element(By.ID, 'password').send_keys(fxa_account.password)\n selenium.find_element(By.ID, 'login').click()\n\nThe test account will be automatically destroyed when it's no longer needed.\n\nSpecifying an environment\n-------------------------\n\nBy default all accounts will be created on the 'stage' environment. You can set\nthe ``FXA_ENV`` environment variable to target 'production' or 'stable'.\n\nIf you need to override the environment for a subset of tests, or run tests against multiple environments, you can use the ``fxa_env`` marker:\n\n.. code-block:: python\n\n @pytest.mark.fxa_env('production')\n def test_production(fxa_account):\n selenium.get('https://example.com/')\n selenium.find_element(By.ID, 'email').send_keys(fxa_account.email)\n selenium.find_element(By.ID, 'password').send_keys(fxa_account.password)\n selenium.find_element(By.ID, 'login').click()\n\n\n @pytest.mark.fxa_env('stage', 'stable')\n def test_stage(fxa_account):\n selenium.get('https://elpmaxe.com/')\n selenium.find_element(By.ID, 'email').send_keys(fxa_account.email)\n selenium.find_element(By.ID, 'password').send_keys(fxa_account.password)\n selenium.find_element(By.ID, 'login').click()\n\nAlternatively, you can override the ``fxa_urls`` fixture for full control of\nthe URLs for your environment:\n\n.. code-block:: python\n\n @pytest.fixture\n def fxa_urls():\n return {\n 'authentication': 'https://api-accounts.stage.mozaws.net/v1',\n 'oauth': 'https://oauth.stage.mozaws.net/v1',\n 'content': 'https://accounts.stage.mozaws.net/',\n 'profile': 'https://profile.stage.mozaws.net/v1',\n 'token': 'https://token.stage.mozaws.net/'}\n\nResources\n---------\n\n- `Release Notes`_\n- `Issue Tracker`_\n- Code_\n\n.. _pytest: http://www.python.org/\n.. _Firefox Accounts: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Firefox_Accounts\n.. _Selenium: https://www.seleniumhq.org/\n.. _Release Notes: http://github.com/mozilla/pytest-fxa/blob/master/CHANGES.rst\n.. _Issue Tracker: http://github.com/mozilla/pytest-fxa/issues\n.. _Code: http://github.com/mozilla/pytest-fxa\n",
"bugtrack_url": null,
"license": "Mozilla Public License 2.0 (MPL 2.0)",
"summary": "pytest plugin for Firefox Accounts",
"version": "1.6.0",
"project_urls": {
"Homepage": "https://github.com/clarmso/pytest-fxa"
},
"split_keywords": [
"py.test",
"pytest",
"mozilla",
"automation",
"firefox",
"account",
"fxa"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e72d7dd29162c43c13499c98b8b0b8f3b057e3deece6e620faf7576f4fc88472",
"md5": "7fc55025cd62b6e84ac3dd6fd3ed946d",
"sha256": "e10b9b6038725f600f381447246e3d844ee806fd4277f9307bd08b70d5ba29c9"
},
"downloads": -1,
"filename": "pytest_fxa_mte-1.6.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7fc55025cd62b6e84ac3dd6fd3ed946d",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 5049,
"upload_time": "2024-10-02T03:57:26",
"upload_time_iso_8601": "2024-10-02T03:57:26.488975Z",
"url": "https://files.pythonhosted.org/packages/e7/2d/7dd29162c43c13499c98b8b0b8f3b057e3deece6e620faf7576f4fc88472/pytest_fxa_mte-1.6.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "131d5c39c4ca91b81bbe36297479e6cee6ab5361da592bebbb2664d34b349c2b",
"md5": "223348cdb13413ca8fcbbeee9633fd76",
"sha256": "c66be9d51b32414cf5cc6b84dfe5bd2ae468d9ba301a3199306a17de70e8f1a7"
},
"downloads": -1,
"filename": "pytest_fxa_mte-1.6.0.tar.gz",
"has_sig": false,
"md5_digest": "223348cdb13413ca8fcbbeee9633fd76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7878,
"upload_time": "2024-10-02T03:57:28",
"upload_time_iso_8601": "2024-10-02T03:57:28.140845Z",
"url": "https://files.pythonhosted.org/packages/13/1d/5c39c4ca91b81bbe36297479e6cee6ab5361da592bebbb2664d34b349c2b/pytest_fxa_mte-1.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-02 03:57:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "clarmso",
"github_project": "pytest-fxa",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "pytest-fxa-mte"
}