Statistics
| Branch: | Tag: | Revision:

root / test / py / cmdlib / testsupport / utils_mock.py @ 3388debb

History | View | Annotate | Download (1.2 kB)

1
#
2
#
3

    
4
# Copyright (C) 2013 Google Inc.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
# General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
# 02110-1301, USA.
20

    
21

    
22
"""Support for mocking the utils module"""
23

    
24

    
25
from cmdlib.testsupport.util import patchModule
26

    
27

    
28
# pylint: disable=C0103
29
def patchUtils(module_under_test):
30
  """Patches the L{ganeti.utils} module for tests.
31

32
  This function is meant to be used as a decorator for test methods.
33

34
  @type module_under_test: string
35
  @param module_under_test: the module within cmdlib which is tested. The
36
        "ganeti.cmdlib" prefix is optional.
37

38
  """
39
  return patchModule(module_under_test, "utils")