# Path: ceagle/api_fake_data/base.py
# CONF = config.CONF
# def route(reg):
#     def decorator(method):
#     def __init__(self, name, endpoint):
#     def _setup_routing(self):
#     def _find_route(self, path):
#     def default(self, path, *args, **kwargs):
#     def get(self, path, **kwargs):
# def api_handler(fake):
#     def real_function_handler(real):
#         def choice_maker(*args, **kwargs):
# def randnum(from_num, to_num, round_by=2):
# class FakeClient(object):
# 
# Path: tests/unit/test.py
# class TestCase(testtools.TestCase):
#     def setUp(self):
#     def mock_config(self, update=None):
#     def post(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def get(self, *args, **kwargs):


import mock
from ceagle.api_fake_data import base
from tests.unit import test
#
#         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.




class ModuleTestCase(test.TestCase):

    def test_api_handler_fake(self):
        self.mock_config({"use_fake_api_data": True})
        fake = lambda: "fake"
        real = lambda: "real"
        self.assertEqual("fake", base.api_handler(fake)(real)())

    def test_api_handler_real(self):
        self.mock_config({"use_fake_api_data": False})
        fake = lambda: "fake"
        real = lambda: "real"
        self.assertEqual("real", base.api_handler(fake)(real)())

    @mock.patch("ceagle.api_fake_data.base.random")
    def test_randnum(self, mock_random):
        mock_random.random.return_value = 42.4242
        self.assertEqual(3828.178, base.randnum(10, 100, 5))

# Path: ceagle/api_fake_data/base.py
# CONF = config.CONF
# def route(reg):
#     def decorator(method):
#     def __init__(self, name, endpoint):
#     def _setup_routing(self):
#     def _find_route(self, path):
#     def default(self, path, *args, **kwargs):
#     def get(self, path, **kwargs):
# def api_handler(fake):
#     def real_function_handler(real):
#         def choice_maker(*args, **kwargs):
# def randnum(from_num, to_num, round_by=2):
# class FakeClient(object):
# 
# Path: tests/unit/test.py
# class TestCase(testtools.TestCase):
#     def setUp(self):
#     def mock_config(self, update=None):
#     def post(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def get(self, *args, **kwargs):


# Path: tests/unit/api_fake_data/test_base.py
import mock
from ceagle.api_fake_data import base
from tests.unit import test

#
#         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.




class ModuleTestCase(test.TestCase):

    def test_api_handler_fake(self):
        self.mock_config({"use_fake_api_data": True})
        fake = lambda: "fake"
        real = lambda: "real"
        self.assertEqual("fake", base.api_handler(fake)(real)())

    def test_api_handler_real(self):
        self.mock_config({"use_fake_api_data": False})
        fake = lambda: "fake"
        real = lambda: "real"
        self.assertEqual("real", base.api_handler(fake)(real)())

    @mock.patch("ceagle.api_fake_data.base.random")
    def test_randnum(self, mock_random):
        mock_random.random.return_value = 42.4242
        self.assertEqual(3828.178, base.randnum(10, 100, 5))

        self.assertEqual(3828.18, base.randnum(10, 100))