1 #pylint: disable-msg=C0111 2 3 # Copyright (c) 2014 The Chromium OS Authors. All rights reserved. 4 # Use of this source code is governed by a BSD-style license that can be 5 # found in the LICENSE file. 6 7 8 class mock_class_base(object): 9 """Base class for a mock statsd/es class.""" 10 def __init__(self, *args, **kwargs): 11 pass 12 13 14 def __getattribute__(self, name): 15 def any_call(*args, **kwargs): 16 pass 17 18 def decorate(f): 19 return f 20 21 # TODO (dshi) crbug.com/256111 - Find better solution for mocking 22 # statsd. 23 def get_client(*args, **kwargs): 24 return self 25 26 if name == 'decorate': 27 return decorate 28 elif name == 'get_client': 29 return get_client 30 elif name == 'indices': 31 return mock_class_base() 32 33 return any_call