Remove obsolete test code from setup.py
[cds-indico.git] / indico / testing / mocks.py
blob999f072a8f433cbb6e565df613eaf439f18f8eff
1 # This file is part of Indico.
2 # Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
4 # Indico is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3 of the
7 # License, or (at your option) any later version.
9 # Indico is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Indico; if not, see <http://www.gnu.org/licenses/>.
18 class MockConferenceHolder:
19 # This class is monkeypatched on top of the real conferenceholder
20 _events = {}
22 def __init__(self):
23 pass
25 @classmethod
26 def add(cls, event):
27 if event.id in cls._events:
28 __tracebackhide__ = True
29 raise Exception("Event '{}' already exists".format(event.id))
30 cls._events[event.id] = event
32 @classmethod
33 def remove(cls, event):
34 del cls._events[event.id]
36 @classmethod
37 def getById(cls, id_):
38 return cls._events.get(id_)
41 class MockConference(object):
42 def __repr__(self):
43 return '<MockConference({})>'.format(self.id)
45 def getId(self):
46 return self.id