diff options
author | Stuart Mackie <wsmackie@juniper.net> | 2016-10-07 12:24:58 -0700 |
---|---|---|
committer | Stuart Mackie <wsmackie@juniper.net> | 2016-10-07 12:24:58 -0700 |
commit | 4faa7f927149a5c4ef7a03523f7bc14523cb9baa (patch) | |
tree | 0be55aa0809cc395e45baeae63db660b4e72fe83 /charms/trusty/cassandra/tests/base.py | |
parent | 82f1a7eb5535b30a95b1e71ff18c315d40d1e6f0 (diff) |
Charms for Contrail 3.1 with Mitaka
Change-Id: Id37f3b9743d1974e31fcd7cd9c54be41bb0c47fb
Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'charms/trusty/cassandra/tests/base.py')
-rwxr-xr-x | charms/trusty/cassandra/tests/base.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/charms/trusty/cassandra/tests/base.py b/charms/trusty/cassandra/tests/base.py new file mode 100755 index 0000000..d308985 --- /dev/null +++ b/charms/trusty/cassandra/tests/base.py @@ -0,0 +1,43 @@ +# Copyright 2015 Canonical Ltd. +# +# This file is part of the Cassandra Charm for Juju. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranties of +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import functools +from itertools import count +import unittest +from unittest.mock import patch + +from testing.mocks import mock_charmhelpers + +patch = functools.partial(patch, autospec=True) # autospec by default. + + +class TestCaseBase(unittest.TestCase): + def setUp(self): + super(TestCaseBase, self).setUp() + + mock_charmhelpers(self) + + is_lxc = patch('helpers.is_lxc', return_value=False) + is_lxc.start() + self.addCleanup(is_lxc.stop) + + emit = patch('helpers.emit') + emit.start() + self.addCleanup(emit.stop) + + time = patch('time.time', side_effect=count(1)) + time.start() + self.addCleanup(time.stop) |