~canonical-platform-qa/snappy-ecosystem-tests/fixing_ci

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os


def get_store_credentials():
    """login credentials exported by shell environment"""
    email=None
    password=None

    try:
        email=os.environ['UBUNTU_STORE_LOGIN_EMAIL']
        password=os.environ['UBUNTU_STORE_LOGIN_PASSWORD']
    except KeyError as err:
        print (err.message)

    return email, password


def is_staging():
    """Return False if environment variable PROD is exported"""
    staging = True
    try:
        if os.environ["STAGING"] == "0":
            staging = False
    except KeyError:
        pass

    return staging


def get_store_web_url():
    """This will return Ubuntu Store web url from staging server,
    if optional staging argument is false then it will return
    production server url """
    return "https://myapps.developer.staging.ubuntu.com/" if is_staging() \
            else "https://myapps.developer.ubuntu.com/"