blob: 8c9a3451b07cf77869f5c33209c09ac21e48b464 [file] [log] [blame] [edit]
"""Expectation diff tests for continuous_tests.protoascii configs."""
import unittest
from catatester import config_utils
_FAILURE_MSG = (
'{} config does not match expectation!\n\n' +
'To update expectations, run:\n' +
'```\n' +
'python continuous-tests/catatester/config_expectations_update.py\n' +
'```')
def _read_expectation(path):
with open(path) as f:
return f.read()
class ConfigExpectationsTest(unittest.TestCase):
def testVerifyProdExpectation(self):
"""Verify prod config matches expectation."""
message = config_utils.parse_continuous_tests_protoascii(
config_utils.PROD_CONFIG_PATH)
expectation = _read_expectation(config_utils.PROD_EXPECTATION_PATH)
self.assertEqual(expectation, str(message), _FAILURE_MSG.format('Prod'))
def testVerifyStagingExpectation(self):
"""Verify staging config matches expectation."""
message = config_utils.parse_continuous_tests_protoascii(
config_utils.STAGING_CONFIG_PATH)
expectation = _read_expectation(config_utils.STAGING_EXPECTATION_PATH)
self.assertEqual(expectation, str(message), _FAILURE_MSG.format('Staging'))
if __name__ == '__main__':
unittest.main()