taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit dc83b85e85110eb7ed2e96ecdbcbb90b5a5620aa
parent 048e4f8dc9cfca81907ff6562125a92f9661882c
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Tue,  3 May 2016 15:05:58 +0200

selenium: adding function to switch between 'test' and 'demo' base URLs,
used to introduce currency mismatches when testing errors management

Diffstat:
Mselenium/test.py | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/selenium/test.py b/selenium/test.py @@ -17,9 +17,10 @@ import time import logging import sys import os +import re logger = logging.getLogger(__name__) -taler_baseurl = os.environ['TALER_BASEURL'] if 'TALER_BASEURL' in os.environ else 'https://test.taler.net/' +taler_baseurl = os.environ.get('TALER_BASEURL', 'https://test.taler.net/') def client_setup(args): """Return a dict containing the driver and the extension's id""" @@ -52,6 +53,17 @@ def is_error(client): return False +def switch_base(): + """If 'test' is in TALER_BASEURL, then make it be 'demo', and viceversa. + Used to trig currency mismatch errors. It assumes that the https://{test,demo}.taler.net + layout is being used""" + global taler_baseurl + url = parse.urlparse(taler_baseurl) + if url[1] == 'test.taler.net': + taler_baseurl = "https://demo.taler.net" + if url[1] == 'demo.taler.net': + taler_baseurl = "https://test.taler.net" + def make_donation(client, amount_value=None): """Make donation at shop.test.taler.net. Assume the wallet has coins""" client.get(parse.urljoin(taler_baseurl, "shop")) @@ -208,6 +220,7 @@ ret = client_setup(args) client = ret['client'] client.implicitly_wait(10) withdraw(client, 10) +switch_base() # inducing error make_donation(client, 6.0) buy_article(client) logger.info("Test passed")