root / test / mocks.py @ 107b0ccb
History | View | Annotate | Download (1.2 kB)
1 | 2f31098c | Iustin Pop | #
|
---|---|---|---|
2 | a8083063 | Iustin Pop | #
|
3 | a8083063 | Iustin Pop | |
4 | a8083063 | Iustin Pop | # Copyright (C) 2006, 2007 Google Inc.
|
5 | a8083063 | Iustin Pop | #
|
6 | a8083063 | Iustin Pop | # This program is free software; you can redistribute it and/or modify
|
7 | a8083063 | Iustin Pop | # it under the terms of the GNU General Public License as published by
|
8 | a8083063 | Iustin Pop | # the Free Software Foundation; either version 2 of the License, or
|
9 | a8083063 | Iustin Pop | # (at your option) any later version.
|
10 | a8083063 | Iustin Pop | #
|
11 | a8083063 | Iustin Pop | # This program is distributed in the hope that it will be useful, but
|
12 | a8083063 | Iustin Pop | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | a8083063 | Iustin Pop | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | a8083063 | Iustin Pop | # General Public License for more details.
|
15 | a8083063 | Iustin Pop | #
|
16 | a8083063 | Iustin Pop | # You should have received a copy of the GNU General Public License
|
17 | a8083063 | Iustin Pop | # along with this program; if not, write to the Free Software
|
18 | a8083063 | Iustin Pop | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 | a8083063 | Iustin Pop | # 02110-1301, USA.
|
20 | a8083063 | Iustin Pop | |
21 | a8083063 | Iustin Pop | |
22 | a8083063 | Iustin Pop | """Module implementing a fake ConfigWriter"""
|
23 | a8083063 | Iustin Pop | |
24 | a8083063 | Iustin Pop | import socket |
25 | 89e1fc26 | Iustin Pop | from ganeti import utils |
26 | a8083063 | Iustin Pop | |
27 | a8083063 | Iustin Pop | class FakeConfig: |
28 | a8083063 | Iustin Pop | """Fake configuration object"""
|
29 | a8083063 | Iustin Pop | |
30 | a8083063 | Iustin Pop | def IsCluster(self): |
31 | a8083063 | Iustin Pop | return True |
32 | a8083063 | Iustin Pop | |
33 | a8083063 | Iustin Pop | def GetNodeList(self): |
34 | a8083063 | Iustin Pop | return ["a", "b", "c"] |
35 | a8083063 | Iustin Pop | |
36 | a8083063 | Iustin Pop | def GetMaster(self): |
37 | 89e1fc26 | Iustin Pop | return utils.HostInfo().name
|
38 | 880478f8 | Iustin Pop | |
39 | 880478f8 | Iustin Pop | |
40 | 880478f8 | Iustin Pop | class FakeSStore: |
41 | 880478f8 | Iustin Pop | """Fake simplestore object"""
|
42 | 880478f8 | Iustin Pop | |
43 | 5fcdc80d | Iustin Pop | def GetClusterName(self): |
44 | 5fcdc80d | Iustin Pop | return "test.cluster" |
45 | 5fcdc80d | Iustin Pop | |
46 | 880478f8 | Iustin Pop | def GetMasterNode(self): |
47 | 89e1fc26 | Iustin Pop | return utils.HostInfo().name |