# -*- encoding: utf-8 -*-
#
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from dci.server.tests import conftest as server_conftest
from dciclient import v1 as dci_client
from dciclient.v1.tests import utils

import pytest


@pytest.fixture(scope='session')
def init_db_and_return_engine(request):
    return server_conftest.init_db_and_return_engine(request)


@pytest.fixture
def server(init_db_and_return_engine):
    return server_conftest.app(init_db_and_return_engine)


@pytest.fixture
def client(server):
    client = dci_client.DCIClient(
        end_point='http://dci_server.com/api',
        login='admin', password='admin'
    )
    flask_adapter = utils.FlaskHTTPAdapter(server.test_client())
    client.s.mount('http://dci_server.com', flask_adapter)
    return client


@pytest.fixture(autouse=True)
def db_provisioning(request, server):
    server_conftest.db_provisioning(request, server)

@@ -785,35 +785,16 @@
 n')%0Adef 
-init_db_and_return_
 engine(r
@@ -829,35 +829,16 @@
 onftest.
-init_db_and_return_
 engine(r
@@ -878,92 +878,267 @@
 ver(
-init_db_and_return_engine):%0A    return server_conftest.app(init_db_and_return_engine
+engine):%0A    return server_conftest.app(engine)%0A%0A%0A@pytest.fixture%0Adef db_clean(request, server):%0A    return server_conftest.db_clean(request, server)%0A%0A%0A@pytest.fixture%0Adef db_provisioning(server, db_clean):%0A    server_conftest.db_provisioning(server, db_clean
 )%0A%0A%0A
@@ -1166,24 +1166,41 @@
 lient(server
+, db_provisioning
 ):%0A    clien
@@ -1464,127 +1464,4 @@
 ent%0A
-%0A%0A@pytest.fixture(autouse=True)%0Adef db_provisioning(request, server):%0A    server_conftest.db_provisioning(request, server)%0A

Fix tests according to server changes.