def users(self):
     if self._users is None:
         from tests.util.users import Users
         self._users = Users(self.values['users'])
     return self._users
def _setup():
    """Initializes the module."""
    from tests.util.users import Users
    global clean_slate
    global compute_service
    global dbaas
    global dbaas_image
    global dbaas_url
    global glance_image
    global keystone_service
    global nova
    global nova_auth_url
    global reddwarf_auth_url
    global test_mgmt
    global typical_nova_image_name
    global use_reaper
    global use_venv
    global users
    global values
    global version_url
    global volume_service
    global white_box
    global instance_create_time
    clean_slate = os.environ.get("CLEAN_SLATE", "False") == "True"
    values = load_configuration()
    if os.environ.get("FAKE_MODE", "False") == "True":
        values["fake_mode"] = True
    use_venv = values.get("use_venv", True)
    nova_auth_url = str(
        values.get("nova_auth_url", "http://localhost:5000/v2.0"))
    reddwarf_auth_url = str(
        values.get("reddwarf_auth_url", "http://localhost:5000/v1.1"))
    dbaas_url = str(values.get("dbaas_url",
                               "http://localhost:8775/v1.0/dbaas"))
    version_url = str(values.get("version_url", "http://localhost:8775/"))
    nova_url = str(values.get("nova_url", "http://localhost:8774/v1.1"))
    nova_code_root = str(values["nova_code_root"])
    nova_conf = str(values["nova_conf"])
    keystone_conf = str(values["keystone_conf"])
    reddwarf_code_root = str(values["reddwarf_code_root"])
    reddwarf_conf = str(values["reddwarf_conf"])
    glance_image = str(values["glance_image"])
    use_reaper = values["use_reaper"]
    instance_create_time = values.get('instance_create_time', 16 * 60)
    if not nova_conf:
        raise ValueError("Configuration value \"nova_conf\" not found.")

    if str(values.get("reddwarf_api_format", "new")) == "old":
        dbaas = WebService(cmd=python_cmd_list() + [
            "%s/bin/reddwarf-api" % reddwarf_code_root,
            "--flagfile=%s" % reddwarf_conf
        ],
                           url=dbaas_url)
    else:
        dbaas = WebService(cmd=python_cmd_list() + [
            "%s/bin/reddwarf-server" % reddwarf_code_root,
            "--config-file=%s" % reddwarf_conf
        ],
                           url=dbaas_url)
    nova = WebService(
        cmd=python_cmd_list() +
        ["%s/bin/nova-api" % nova_code_root,
         "--flagfile=%s" % nova_conf],
        url=nova_url)
    volume_service = Service(
        cmd=python_cmd_list() +
        ["%s/bin/nova-volume" % nova_code_root,
         "--flagfile=%s" % nova_conf])
    compute_service = Service(
        cmd=python_cmd_list() +
        ["%s/bin/nova-compute" % nova_code_root,
         "--flagfile=%s" % nova_conf])
    keystone_service = Service(
        python_cmd_list() +
        [keystone_bin("keystone-auth"),
         "-c %s" % keystone_conf])

    users = Users(values["users"])
    dbaas_image = values.get("dbaas_image", None)
    typical_nova_image_name = values.get("typical_nova_image_name", None)

    # If true, we import certain classes and test using internal code.
    white_box = values.get("white_box", False)
    # If true, we run the mgmt tests, if not we don't.
    test_mgmt = values.get("test_mgmt", False)
 def setUp(self):
     self.users = Users(USER_LIST)