Skip to content

Commit

Permalink
Merge pull request #519 from cehbrecht/fix-tests
Browse files Browse the repository at this point in the history
fix tests with language option
  • Loading branch information
cehbrecht committed Feb 12, 2020
2 parents cb53282 + 4655b08 commit a3d1ee9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions tests/test-pywps.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[server]
language=en-US,fr-CA

[logging]
level=INFO
file=/tmp/pywps-test.log
Expand Down
7 changes: 4 additions & 3 deletions tests/test_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
import lxml
import lxml.etree
from pywps.configuration import CONFIG
from pywps import configuration
from pywps.app import Process, Service
from pywps.app.Common import Metadata
from pywps import get_ElementMakerForVersion
Expand Down Expand Up @@ -139,7 +139,8 @@ def test_version2(self):

class CapabilitiesTranslationsTest(unittest.TestCase):
def setUp(self):
CONFIG.set('server', 'language', 'en-US,fr-CA')
configuration.load_configuration()
configuration.CONFIG.set('server', 'language', 'en-US,fr-CA')
self.client = client_for(
Service(
processes=[
Expand All @@ -162,7 +163,7 @@ def setUp(self):
)

def tearDown(self):
CONFIG.set('server', 'language', 'en-US')
configuration.CONFIG.set('server', 'language', 'en-US')

def test_get_translated(self):
resp = self.client.get('?Request=GetCapabilities&service=wps&language=fr-CA')
Expand Down
7 changes: 4 additions & 3 deletions tests/test_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pywps.app.Common import Metadata
from pywps.inout.literaltypes import AllowedValue
from pywps.validator.allowed_value import ALLOWEDVALUETYPE
from pywps.configuration import CONFIG
from pywps import configuration

from pywps.tests import assert_pywps_version, client_for

Expand Down Expand Up @@ -141,7 +141,8 @@ def test_post_two_args(self):
class DescribeProcessTranslationsTest(unittest.TestCase):

def setUp(self):
CONFIG.set('server', 'language', 'en-US,fr-CA')
configuration.get_config_value('server', 'language')
configuration.CONFIG.set('server', 'language', 'en-US,fr-CA')
self.client = client_for(
Service(
processes=[
Expand Down Expand Up @@ -196,7 +197,7 @@ def setUp(self):
)

def tearDown(self):
CONFIG.set('server', 'language', 'en-US')
configuration.CONFIG.set('server', 'language', 'en-US')

def test_get_describe_translations(self):
resp = self.client.get('?Request=DescribeProcess&service=wps&version=1.0.0&identifier=all&language=fr-CA')
Expand Down
7 changes: 4 additions & 3 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pywps.app.basic import get_xpath_ns
from pywps._compat import text_type
from pywps.tests import client_for, assert_response_success
from pywps.configuration import CONFIG
from pywps import configuration

from pywps._compat import PY2
from pywps._compat import StringIO
Expand Down Expand Up @@ -503,10 +503,11 @@ def test_output_response_dataType(self):
class ExecuteTranslationsTest(unittest.TestCase):

def setUp(self):
CONFIG.set('server', 'language', 'en-US,fr-CA')
configuration.get_config_value('server', 'language')
configuration.CONFIG.set('server', 'language', 'en-US,fr-CA')

def tearDown(self):
CONFIG.set('server', 'language', 'en-US')
configuration.CONFIG.set('server', 'language', 'en-US')

def test_translations(self):
client = client_for(Service(processes=[create_translated_greeter()]))
Expand Down

0 comments on commit a3d1ee9

Please sign in to comment.