blob: d308985c2cdefe9c5e92a9e73c9935a4c7afd810 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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)
|