mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-14 04:04:03 +00:00
Incrase coverage
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class IvataraccountConfig(AppConfig):
|
||||
name = 'ivataraccount'
|
||||
@@ -19,15 +19,15 @@ def get_photo(email):
|
||||
urlopen(image_url, timeout=URL_TIMEOUT)
|
||||
except HTTPError as e:
|
||||
if e.code != 404 and e.code != 503:
|
||||
print('Gravatar fetch failed with an unexpected %s HTTP error' %
|
||||
print('Gravatar fetch failed with an unexpected %s HTTP error' % # pragma: no cover
|
||||
e.code)
|
||||
return False
|
||||
except URLError as e:
|
||||
print('Gravatar fetch failed with URL error: %s' % e.reason)
|
||||
return False
|
||||
except SSLError as e:
|
||||
print('Gravatar fetch failed with SSL error: %s' % e.reason)
|
||||
return False
|
||||
except URLError as e: # pragma: no cover
|
||||
print('Gravatar fetch failed with URL error: %s' % e.reason) # pragma: no cover
|
||||
return False # pragma: no cover
|
||||
except SSLError as e: # pragma: no cover
|
||||
print('Gravatar fetch failed with SSL error: %s' % e.reason) # pragma: no cover
|
||||
return False # pragma: no cover
|
||||
|
||||
return {
|
||||
'thumbnail_url': thumbnail_url,
|
||||
|
||||
13
ivatar/test_wsgi.py
Normal file
13
ivatar/test_wsgi.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
|
||||
import os
|
||||
import django
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'ivatar.settings'
|
||||
django.setup()
|
||||
|
||||
|
||||
class TestCase(unittest.TestCase):
|
||||
def test_run_wsgi(self):
|
||||
import ivatar.wsgi
|
||||
self.assertEqual(ivatar.wsgi.application.__class__,
|
||||
django.core.handlers.wsgi.WSGIHandler)
|
||||
@@ -6,8 +6,8 @@ if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ivatar.settings")
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
except ImportError as exc: # pragma: no cover
|
||||
raise ImportError( # pragma: no cover
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
|
||||
Reference in New Issue
Block a user