Alex Klein | 69339cc | 2019-07-22 14:08:35 -0600 | [diff] [blame^] | 1 | # -*- coding: utf-8 -*- |
| 2 | # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """API config object.""" |
| 7 | |
| 8 | from __future__ import print_function |
| 9 | |
| 10 | import collections |
| 11 | |
| 12 | |
| 13 | ApiConfig = collections.namedtuple('ApiConfig', ['validate_only']) |
| 14 | |
| 15 | |
| 16 | class ApiConfigMixin(object): |
| 17 | """Mixin to add an API Config factory properties. |
| 18 | |
| 19 | This is meant to be used for tests to make these configs more uniform across |
| 20 | all of the tests since there's very little to change anyway. |
| 21 | """ |
| 22 | |
| 23 | @property |
| 24 | def api_config(self): |
| 25 | return ApiConfig(validate_only=False) |
| 26 | |
| 27 | @property |
| 28 | def validate_only_config(self): |
| 29 | return ApiConfig(validate_only=True) |