[FIX] tests: use 127.0.0.1 instead of localhost

Cookies can't be set on 'localhost' using werkzeug set_cookie.
This commit is contained in:
Jeremy Kersten
2015-08-26 16:01:18 +02:00
committed by David Monjoie
parent 8eb8a982f9
commit 57c4787d09
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -250,7 +250,7 @@ class HttpCase(TransactionCase):
def url_open(self, url, data=None, timeout=10):
if url.startswith('/'):
url = "http://localhost:%s%s" % (PORT, url)
url = "http://%s:%s%s" % (HOST, PORT, url)
return self.opener.open(url, data, timeout)
def authenticate(self, user, password):
@@ -328,7 +328,7 @@ class HttpCase(TransactionCase):
def phantom_run(self, cmd, timeout):
_logger.info('phantom_run executing %s', ' '.join(cmd))
ls_glob = os.path.expanduser('~/.qws/share/data/Ofi Labs/PhantomJS/http_localhost_%s.*'%PORT)
ls_glob = os.path.expanduser('~/.qws/share/data/Ofi Labs/PhantomJS/http_%s_%s.*' % (HOST, PORT))
for i in glob.glob(ls_glob):
_logger.info('phantomjs unlink localstorage %s', i)
os.unlink(i)
+3 -2
View File
@@ -2,6 +2,7 @@
// jshint evil: true, loopfunc: true
var system = require('system');
var HOST = '127.0.0.1';
function waitFor (condition, callback, timeout, timeoutMessageCallback) {
timeout = timeout || 10000;
@@ -24,14 +25,14 @@ function PhantomTest() {
this.options = JSON.parse(system.args[system.args.length-1]);
this.inject = this.options.inject || [];
this.timeout = this.options.timeout ? Math.round(parseFloat(this.options.timeout)*1000 - 5000) : 10000;
this.origin = 'http://localhost';
this.origin = 'http://' + HOST;
this.origin += this.options.port ? ':' + this.options.port : '';
// ----------------------------------------------------
// configure phantom and page
// ----------------------------------------------------
phantom.addCookie({
'domain': 'localhost',
'domain': HOST,
'name': 'session_id',
'value': this.options.session_id,
});