# Path: tuskar/common/utils.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# class LazyPluggable(object):
#     def __init__(self, pivot, config_group=None, **backends):
#     def __get_backend(self):
#     def __getattr__(self, key):
# def is_int_like(val):
# def read_cached_file(filename, cache_info, reload_func=None):
# 
# Path: tuskar/tests/base.py
# CONF = cfg.CONF
# _DB_CACHE = None
#             _DB_CACHE = Database(session, migration,
#                                     sql_connection=CONF.database.connection,
#                                     sqlite_db=CONF.sqlite_db,
#                                     sqlite_clean_db=CONF.sqlite_clean_db)
# class Database(fixtures.Fixture):
# class ReplaceModule(fixtures.Fixture):
# class MoxStubout(fixtures.Fixture):
# class TestingException(Exception):
# class TestCase(testtools.TestCase):
# class TimeOverride(fixtures.Fixture):
#     def __init__(self, db_session, db_migrate, sql_connection,
#                     sqlite_db, sqlite_clean_db):
#     def setUp(self):
#     def post_migrations(self):
#     def __init__(self, name, new_value):
#     def _restore(self, old_value):
#     def setUp(self):
#     def setUp(self):
#     def setUp(self):
#     def _clear_attrs(self):
#     def config(self, **kw):
#     def path_get(self, project_file=None):
#     def setUp(self):


import __builtin__
import os
import os.path
import mox
from tuskar.common import utils
from tuskar.tests import base
# vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2011 Justin Santa Barbara
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
#    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.





class GenericUtilsTestCase(base.TestCase):

    def test_read_cached_file(self):
        self.mox.StubOutWithMock(os.path, "getmtime")
        os.path.getmtime(mox.IgnoreArg()).AndReturn(1)
        self.mox.ReplayAll()

        cache_data = {"data": 1123, "mtime": 1}

# Path: tuskar/common/utils.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# class LazyPluggable(object):
#     def __init__(self, pivot, config_group=None, **backends):
#     def __get_backend(self):
#     def __getattr__(self, key):
# def is_int_like(val):
# def read_cached_file(filename, cache_info, reload_func=None):
# 
# Path: tuskar/tests/base.py
# CONF = cfg.CONF
# _DB_CACHE = None
#             _DB_CACHE = Database(session, migration,
#                                     sql_connection=CONF.database.connection,
#                                     sqlite_db=CONF.sqlite_db,
#                                     sqlite_clean_db=CONF.sqlite_clean_db)
# class Database(fixtures.Fixture):
# class ReplaceModule(fixtures.Fixture):
# class MoxStubout(fixtures.Fixture):
# class TestingException(Exception):
# class TestCase(testtools.TestCase):
# class TimeOverride(fixtures.Fixture):
#     def __init__(self, db_session, db_migrate, sql_connection,
#                     sqlite_db, sqlite_clean_db):
#     def setUp(self):
#     def post_migrations(self):
#     def __init__(self, name, new_value):
#     def _restore(self, old_value):
#     def setUp(self):
#     def setUp(self):
#     def setUp(self):
#     def _clear_attrs(self):
#     def config(self, **kw):
#     def path_get(self, project_file=None):
#     def setUp(self):


# Path: tuskar/tests/test_utils.py
import __builtin__
import os
import os.path
import mox
from tuskar.common import utils
from tuskar.tests import base

# vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2011 Justin Santa Barbara
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
#    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.





class GenericUtilsTestCase(base.TestCase):

    def test_read_cached_file(self):
        self.mox.StubOutWithMock(os.path, "getmtime")
        os.path.getmtime(mox.IgnoreArg()).AndReturn(1)
        self.mox.ReplayAll()

        cache_data = {"data": 1123, "mtime": 1}

        data = utils.read_cached_file("/this/is/a/fake", cache_data)