Skip the openid tests if the openid module is not installed.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 14 Jul 2013 16:23:52 +0000 (11:23 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 14 Jul 2013 16:23:52 +0000 (11:23 -0500)
This commit sponsored by Brandon Smith.  Thank you!

mediagoblin/tests/test_openid.py

index bba46db800c5ccb49811ad011644b4655b144313..23a2290e669d40d15aa95ce4e5ab6870b6b20cfc 100644 (file)
 #
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 import urlparse
 import pkg_resources
 import pytest
 import mock
 
-from openid.consumer.consumer import SuccessResponse
+openid_consumer = pytest.importorskip(
+    "openid.consumer.consumer")
 
 from mediagoblin import mg_globals
 from mediagoblin.db.base import Session
@@ -27,7 +29,6 @@ from mediagoblin.plugins.openid.models import OpenIDUserURL
 from mediagoblin.tests.tools import get_app, fixture_add_user
 from mediagoblin.tools import template
 
-
 # App with plugin enabled
 @pytest.fixture()
 def openid_plugin_app(request):
@@ -41,7 +42,7 @@ def openid_plugin_app(request):
 class TestOpenIDPlugin(object):
     def _setup(self, openid_plugin_app, value=True, edit=False, delete=False):
         if value:
-            response = SuccessResponse(mock.Mock(), mock.Mock())
+            response = openid_consumer.SuccessResponse(mock.Mock(), mock.Mock())
             if edit or delete:
                 response.identity_url = u'http://add.myopenid.com'
             else: