# Path: tenable_io/config.py
# class TenableIOConfig(object):
# 
#     @staticmethod
#     def get(key):
#         return config.get('tenable_io', key)
# 
# Path: tests/config.py
# class TenableIOTestConfig(object):
# 
#     @staticmethod
#     def get(key):
#         return config.get('tenable_io-test', key)


import base64
import hashlib
import json
import requests
from time import sleep, time
from tenable_io.config import TenableIOConfig
from tests.config import TenableIOTestConfig
    start_time = time()
    elapsed = 0
    while not condition(value) and elapsed <= WAIT_TIMEOUT:
        sleep(WAIT_INTERVAL)
        value = expression()
        elapsed = time() - start_time
    assert condition(value), u'Timeout waiting for a condition (%d seconds elapsed).' % elapsed
    return value


def upload_image(name, tag, vulnerable=False):

    host = TenableIOTestConfig.get('registry_host')

    file_path = './tests/docker_images/scratch.tgz'
    digest_tar = u'sha256:188307c3217788f441fa8a31e1bdbc4b4286a12b12da90038a8b1e22241176c5'  # tar
    digest_tgz = u'sha256:96626451b6947696c15b96333de54fd329f8f8cb5073163ef881153b37aafe7d'  # tgz

    if vulnerable:
        file_path = './tests/docker_images/alpine_3_1.tgz'
        digest_tar = u'sha256:534a5cc0b456e6d82b52614ef3a731e2afc19c89f991c11b41d364727bea7c2d'  # tar
        digest_tgz = u'sha256:57735dd315307043f9d21fe748f1c5bab781514b4db2c7f8cbac34ba39331178'  # tgz

    '''
    Get authorization token for the session.
    '''
    response = requests.get(
        host + '/v2/token',
        headers={
            u'Authorization': u'Basic %s' % base64.b64encode(

# Path: tenable_io/config.py
# class TenableIOConfig(object):
# 
#     @staticmethod
#     def get(key):
#         return config.get('tenable_io', key)
# 
# Path: tests/config.py
# class TenableIOTestConfig(object):
# 
#     @staticmethod
#     def get(key):
#         return config.get('tenable_io-test', key)


# Path: tests/integration/api/utils/utils.py
import base64
import hashlib
import json
import requests
from time import sleep, time
from tenable_io.config import TenableIOConfig
from tests.config import TenableIOTestConfig

    start_time = time()
    elapsed = 0
    while not condition(value) and elapsed <= WAIT_TIMEOUT:
        sleep(WAIT_INTERVAL)
        value = expression()
        elapsed = time() - start_time
    assert condition(value), u'Timeout waiting for a condition (%d seconds elapsed).' % elapsed
    return value


def upload_image(name, tag, vulnerable=False):

    host = TenableIOTestConfig.get('registry_host')

    file_path = './tests/docker_images/scratch.tgz'
    digest_tar = u'sha256:188307c3217788f441fa8a31e1bdbc4b4286a12b12da90038a8b1e22241176c5'  # tar
    digest_tgz = u'sha256:96626451b6947696c15b96333de54fd329f8f8cb5073163ef881153b37aafe7d'  # tgz

    if vulnerable:
        file_path = './tests/docker_images/alpine_3_1.tgz'
        digest_tar = u'sha256:534a5cc0b456e6d82b52614ef3a731e2afc19c89f991c11b41d364727bea7c2d'  # tar
        digest_tgz = u'sha256:57735dd315307043f9d21fe748f1c5bab781514b4db2c7f8cbac34ba39331178'  # tgz

    '''
    Get authorization token for the session.
    '''
    response = requests.get(
        host + '/v2/token',
        headers={
            u'Authorization': u'Basic %s' % base64.b64encode(

                (u'%s:%s' % (TenableIOConfig.get(u'access_key'), TenableIOConfig.get(u'secret_key')))