Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
add --apibaseurl option
Browse files Browse the repository at this point in the history
  • Loading branch information
bebef1987 committed Dec 16, 2011
1 parent e2b218e commit 5e84632
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
54 changes: 54 additions & 0 deletions conftest.py
@@ -0,0 +1,54 @@
#!/usr/bin/env python

# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla WebQA Selenium Tests.
#
# The Initial Developer of the Original Code is
# Mozilla.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Bebe <florin.strugariu@softvision.ro>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****

import mozwebqa

def pytest_runtest_setup(item):
mozwebqa.TestSetup.api_base_url = item.config.option.api_base_url

def pytest_addoption(parser):
parser.addoption("--apibaseurl",
action="store",
dest='api_base_url',
metavar='str',
default="https://addons-dev.allizom.org",
help="specify the api url")

def pytest_funcarg__mozwebqa(request):
return mozwebqa.TestSetup(request)
3 changes: 1 addition & 2 deletions pages/addons_api.py
Expand Up @@ -46,8 +46,7 @@ class AddOnsAPI(object):

def __init__(self, testsetup, search_extension='firebug'):

self.api_base_url = testsetup.base_url + '/en-us/firefox/api/1.5/search/'
self.search_url = self.api_base_url + search_extension
self.search_url = '%s/en-us/firefox/api/1.5/search/%s' % (testsetup.api_base_url, search_extension)
self.parsed_xml = BeautifulStoneSoup(urllib2.urlopen(self.search_url))

def get_xml_for_single_addon(self, addon_name):
Expand Down
2 changes: 1 addition & 1 deletion pages/discovery.py
Expand Up @@ -68,7 +68,7 @@ class DiscoveryPane(Base):

def __init__(self, testsetup, path):
Base.__init__(self, testsetup)
self.selenium.get("%s/%s" % (self.base_url, path))
self.selenium.get("%s/%s" % (self.api_base_url, path))
#resizing this page for elements that disappear when the window is < 1000
#self.selenium.set_window_size(1000, 1000) Commented because this selenium call is still in beta

Expand Down
1 change: 1 addition & 0 deletions pages/page.py
Expand Up @@ -59,6 +59,7 @@ def __init__(self, testsetup):
'''
self.testsetup = testsetup
self.base_url = testsetup.base_url
self.api_base_url = testsetup.api_base_url
self.selenium = testsetup.selenium
self.timeout = testsetup.timeout

Expand Down

0 comments on commit 5e84632

Please sign in to comment.