Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add command line options

  • Loading branch information...
commit d03483c8421e4c4b14af9fa1cabd3f503564aca3 1 parent e3f2fbd
Florin Strugariu bebef1987 authored
Showing with 37 additions and 11 deletions.
  1. +30 −1 conftest.py
  2. +0 −1  requirements.txt
  3. +7 −9 tests/test_redirects.py
31 conftest.py
View
@@ -4,7 +4,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-import py
+import pytest
+
LOCALES = ['ach', 'af','ak','ar', 'as', 'ast', 'be', 'bg', 'bn-BD', 'bn-IN', 'br', 'bs', 'ca', 'cs', 'csb', 'cy', 'da', 'de', 'el', 'en-GB',
'en-ZA', 'eo', 'es-AR', 'es-CL', 'es-ES', 'es-MX', 'et', 'eu', 'fa', 'ff', 'fi', 'fr', 'fy-NL', 'ga-IE', 'gd', 'gl', 'gu-IN',
'he', 'hi-IN', 'hr', 'hu', 'hy-AM', 'id', 'is', 'it', 'ja', 'kk', 'km', 'kn', 'ko', 'ku', 'lg', 'lij', 'lt', 'lv', 'mai', 'mk',
@@ -19,3 +20,31 @@ def pytest_generate_tests(metafunc):
if 'os' in metafunc.funcargnames:
metafunc.parametrize('os', OS)
+
+def pytest_sessionstart(session):
+ print session.config.option.base_url
+ if session.config.option.base_url is None:
+ raise pytest.UsageError('--baseurl must be specified.')
+
+def pytest_addoption(parser):
+ parser.addoption("--baseurl",
+ action='store',
+ dest='base_url',
+ metavar='url',
+ help='base url for the application under test.')
+
+ parser.addoption("--product",
+ action='store',
+ dest='product',
+ metavar='str',
+ default='firefox-latest',
+ help='product under test')
+
+def pytest_funcarg__testsetup(request):
+ return TestSetup(request)
+
+class TestSetup(object):
+
+ def __init__(self, options):
+ self.base_url = options.config.option.base_url
+ self.product = options.config.option.product
1  requirements.txt
View
@@ -4,7 +4,6 @@
py==1.4.8
pytest==2.2.4
pytest-xdist==1.8
-pytest-mozwebqa==1.0
unittestzero
requests==0.11.2
beautifulsoup4==4.0.4
16 tests/test_redirects.py
View
@@ -12,8 +12,6 @@
from base import Base
-@pytest.mark.skip_selenium
-@pytest.mark.nondestructive
class TestRedirects(Base):
@pytest.mark.parametrize('url', ["http://download.allizom.org/", "https://download.allizom.org/"])
@@ -33,9 +31,9 @@ def test_that_checks_redirect_using_incorrect_query_values(self, url):
Assert.equal(parsed_url.netloc, urlparse(url).netloc, 'Failed on %s \nUsing %s' % (url, param))
Assert.equal(parsed_url.query, urlencode(param), 'Failed on %s \nUsing %s' % (url, param))
- def test_that_checks_redirect_using_locales_and_os(self, mozwebqa, lang, os):
+ def test_that_checks_redirect_using_locales_and_os(self, testsetup, lang, os):
- url = mozwebqa.base_url
+ url = testsetup.base_url
# Ja locale has a special code for mac
if lang == 'ja' and os == 'osx':
@@ -54,10 +52,10 @@ def test_that_checks_redirect_using_locales_and_os(self, mozwebqa, lang, os):
Assert.equal(response.status_code, requests.codes.ok, 'Failed on %s \nUsing %s' % (url, param))
Assert.equal(parsed_url.scheme, 'http', 'Failed on %s \nUsing %s' % (url, param))
- def test_stub_installer_redirect_for_en_us_and_win(self, mozwebqa):
- url = mozwebqa.base_url
+ def test_stub_installer_redirect_for_en_us_and_win(self, testsetup):
+ url = testsetup.base_url
param = {
- 'product': 'firefox-16.0b6',
+ 'product': testsetup.product,
'lang': 'en-US',
'os': 'win'
}
@@ -74,8 +72,8 @@ def test_stub_installer_redirect_for_en_us_and_win(self, mozwebqa):
{'name': 'win', 'folder': 'win32'},
{'name': 'osx', 'folder': 'mac'},
{'name': 'linux', 'folder': 'linux-i686'}])
- def test_stub_installer_redirect_for_firefox_latest_alias(self, mozwebqa, operating_system):
- url = mozwebqa.base_url
+ def test_stub_installer_redirect_for_firefox_latest_alias(self, testsetup, operating_system):
+ url = testsetup.base_url
param = {
'product': 'firefox-latest',
'os': operating_system['name']
Please sign in to comment.
Something went wrong with that request. Please try again.