Modify test case for broader coverage

This particular test as changed in this patch fails tox on local machines
where URL gets redirected by internet service provider. This was observed on
multiple machines running Linux VM on Mac and Windows. Also adding i18n for
message and parameterizing it.

Change-Id: I4cb768016d5b52ab19d1886716d08e36e36f07f1
This commit is contained in:
spzala
2015-11-10 09:53:31 -08:00
parent 8585e8fe1e
commit ffb741201c

View File

@@ -12,6 +12,7 @@
from toscaparser.common.exception import URLException
from toscaparser.tests.base import TestCase
from toscaparser.utils.gettextutils import _
import toscaparser.utils.urlutils
import toscaparser.utils.yamlparser
@@ -48,9 +49,10 @@ class UrlUtilsTest(TestCase):
"http://github.com/proj1/scripts/b.js")
def test_load_url_errors(self):
err_msg = ('Failed to reach server http://www.nourl.org.'
url = "http://www.badurl."
err_msg = (_('Failed to reach server %(url)s.'
' Reason is: [Errno -2] Name or service not known.')
url = "http://www.nourl.org"
% {'url': url})
err = self.assertRaises(URLException,
YAML_LOADER,
url,