summaryrefslogtreecommitdiffstats
path: root/src/test/rgw/bucket_notification/__init__.py
blob: 6785fce9263447f7aa49040f461a855396a02cdf (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
import configparser
import os

def setup():
    cfg = configparser.RawConfigParser()
    try:
        path = os.environ['BNTESTS_CONF']
    except KeyError:
        raise RuntimeError(
            'To run tests, point environment '
            + 'variable BNTESTS_CONF to a config file.',
            )
    cfg.read(path)

    if not cfg.defaults():
        raise RuntimeError('Your config file is missing the DEFAULT section!')
    if not cfg.has_section("s3 main"):
        raise RuntimeError('Your config file is missing the "s3 main" section!')

    defaults = cfg.defaults()

    global default_host
    default_host = defaults.get("host")

    global default_port
    default_port = int(defaults.get("port"))

    global main_access_key
    main_access_key = cfg.get('s3 main',"access_key")
    
    global main_secret_key
    main_secret_key = cfg.get('s3 main',"secret_key")

def get_config_host():
    global default_host
    return default_host

def get_config_port():
    global default_port
    return default_port

def get_access_key():
    global main_access_key
    return main_access_key

def get_secret_key():
    global main_secret_key
    return main_secret_key