From 17f054c1cade850d0468278edcdc0c4eafc4510d Mon Sep 17 00:00:00 2001
From: Leah Klearman <lklrmn@gmail.com>
Date: Tue, 11 Sep 2012 18:52:37 -0700
Subject: [PATCH] replace command line flag with server detecting code

---
 automation-tests/123done/conftest.py          | 25 -------------------
 .../123done/tests/test_change_password.py     | 12 ++++++++-
 2 files changed, 11 insertions(+), 26 deletions(-)
 delete mode 100644 automation-tests/123done/conftest.py

diff --git a/automation-tests/123done/conftest.py b/automation-tests/123done/conftest.py
deleted file mode 100644
index e8062b476..000000000
--- a/automation-tests/123done/conftest.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# 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
-
-def pytest_runtest_setup(item):
-    pytest_mozwebqa = py.test.config.pluginmanager.getplugin("mozwebqa")
-    pytest_mozwebqa.TestSetup.server_base_url = item.config.option.server_base_url
-
-
-def pytest_addoption(parser):
-    parser.addoption("--serverbaseurl",
-                     action="store",
-                     dest='server_base_url',
-                     metavar='str',
-                     default="https://login.dev.anosrep.org",
-                     help="specify the server base url")
-
-
-def pytest_funcarg__mozwebqa(request):
-    pytest_mozwebqa = py.test.config.pluginmanager.getplugin("mozwebqa")
-    return pytest_mozwebqa.TestSetup(request)
diff --git a/automation-tests/123done/tests/test_change_password.py b/automation-tests/123done/tests/test_change_password.py
index 2c6f01525..486e94037 100644
--- a/automation-tests/123done/tests/test_change_password.py
+++ b/automation-tests/123done/tests/test_change_password.py
@@ -14,6 +14,16 @@ import pytest
 
 class TestChangePassword:
 
+    def _persona_server_url(self, mozwebqa):
+        server = None
+        if 'dev' in mozwebqa.base_url:
+            server = 'https://login.dev.anosrep.org'
+        elif 'beta' in mozwebqa.base_url:
+            server = 'https://login.anosrep.org'
+        else:
+            server = 'https://login.persona.org'
+        return server
+
     def test_can_change_user_password(self, mozwebqa):
         user = MockUser()
         home_pg = HomePage(mozwebqa)
@@ -30,7 +40,7 @@ class TestChangePassword:
         from browserid.pages.complete_registration import CompleteRegistration
         CompleteRegistration(mozwebqa.selenium, mozwebqa.timeout, email.verify_user_link)
 
-        mozwebqa.selenium.get(mozwebqa.server_base_url)
+        mozwebqa.selenium.get(self._persona_server_url(mozwebqa))
         from browserid.pages.account_manager import AccountManager
         account_manager = AccountManager(mozwebqa.selenium, mozwebqa.timeout)
 
-- 
GitLab