Chromium Code Reviews| Index: dashboard/dashboard/models/table_config.py |
| diff --git a/dashboard/dashboard/models/table_config.py b/dashboard/dashboard/models/table_config.py |
| index d609bc1f1d946b30759b3ff36dd6f681a7e8f3e9..edd6e6e247235ec59b37797303605544d576b451 100644 |
| --- a/dashboard/dashboard/models/table_config.py |
| +++ b/dashboard/dashboard/models/table_config.py |
| @@ -31,6 +31,7 @@ import json |
| from google.appengine.ext import ndb |
| +from dashboard.common import utils |
| from dashboard.models import internal_only_model |
| @@ -96,6 +97,13 @@ def CreateTableConfig(name, bots, tests, layout, username): |
| error_message = '%s already exists.' % name |
| return None, error_message |
| + for bot in bots: |
| + for test in tests: |
| + test_key = utils.TestMetadataKey(bot + '/' + test) |
| + if not test_key.get(): |
| + error_message = '%s is not a valid test.' % test |
| + return None, error_message |
|
eakuefner
2017/01/28 00:22:17
It occurs to me that this pattern is kind of funky
jessimb
2017/01/30 19:23:10
Feels much cleaner!
Note that I didn't use self.Re
|
| + |
| # Input validates, create table now. |
| error_message = 'TableConfig created successfully.' |
| table_config = TableConfig(id=name, bots=valid_bots, tests=tests, |