Skip to content

Commit

Permalink
Fixes Travis geonode-selenium build
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Feb 21, 2019
1 parent 79a4da9 commit 04ce54c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ install:
sudo apt-get install -y python-virtualenv python-imaging python-lxml python-pyproj python-shapely python-nose python-httplib2 python-httplib2 gettext;
sudo apt-get install -y python-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev libpq-dev libgdal-dev git default-jdk;
sudo apt-add-repository -y ppa:webupd8team/java; sudo apt update;
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections;
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections;
sudo apt install -y oracle-java8-set-default ant maven;
sudo update-java-alternatives --set java-8-oracle;
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
Expand All @@ -194,6 +196,7 @@ before_script:
true;
else
echo "Initialize DB";
sudo apt install postgresql-9.6-postgis-2.4;
psql -U postgres -c "create extension postgis";
chmod +x scripts/misc/create_dbs_travis.sh
scripts/misc/create_dbs_travis.sh before_script;
Expand Down
6 changes: 3 additions & 3 deletions geonode/proxy/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def setUp(self):
def test_validate_host_disabled_in_debug(self):
"""If PROXY_ALLOWED_HOSTS is empty and DEBUG is True, all hosts pass the proxy."""
response = self.client.get('%s?url=%s' %
(self.proxy_url, self.url), follow=True)
(self.proxy_url, self.url))
# 404 - NOT FOUND
if response.status_code != 404:
self.assertEqual(response.status_code, 200)
Expand All @@ -58,7 +58,7 @@ def test_validate_host_disabled_in_debug(self):
def test_validate_host_disabled_not_in_debug(self):
"""If PROXY_ALLOWED_HOSTS is empty and DEBUG is False requests should return 403."""
response = self.client.get('%s?url=%s' %
(self.proxy_url, self.url), follow=True)
(self.proxy_url, self.url))
# 404 - NOT FOUND
if response.status_code != 404:
self.assertEqual(response.status_code, 403)
Expand All @@ -68,7 +68,7 @@ def test_validate_host_disabled_not_in_debug(self):
def test_proxy_allowed_host(self):
"""If PROXY_ALLOWED_HOSTS is empty and DEBUG is False requests should return 403."""
response = self.client.get('%s?url=%s' %
(self.proxy_url, self.url), follow=True)
(self.proxy_url, self.url))
# 404 - NOT FOUND
if response.status_code != 404:
self.assertEqual(response.status_code, 200)
4 changes: 3 additions & 1 deletion geonode/proxy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ def proxy(request, url=None, response_callback=None,
"Accept-encoding": encoding, })

if url.scheme == 'https':
conn = HTTPSConnection(url.hostname, url.port)
import ssl
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
conn = HTTPSConnection(url.hostname, url.port, context=context)
else:
conn = HTTPConnection(url.hostname, url.port)
parsed = urlparse(raw_url)
Expand Down

0 comments on commit 04ce54c

Please sign in to comment.