| Index: dashboard/dashboard/create_health_report_test.py
|
| diff --git a/dashboard/dashboard/create_health_report_test.py b/dashboard/dashboard/create_health_report_test.py
|
| index 6cf645d9db2aca4a1b0be51dee6189840cb298bb..238ca9c889f6c075af7c994652767d87c38e42dd 100644
|
| --- a/dashboard/dashboard/create_health_report_test.py
|
| +++ b/dashboard/dashboard/create_health_report_test.py
|
| @@ -19,9 +19,10 @@ from dashboard.models import graph_data
|
| _SAMPLE_TABLE_CONFIG = {
|
| 'tableName': 'my_sample_config',
|
| 'tableBots': 'ChromiumPerf/win\nChromiumPerf/linux',
|
| - 'tableTests': 'my_test_suite/my_test_*\nmy_test_suite/my_other_test_*',
|
| - 'tableLayout': '{ "system_health.memory_mobile/foreground/ashmem":'
|
| - '["Foreground", "Ashmem"]}',
|
| + 'tableTests': 'my_test_suite/my_test_avg\nmy_test_suite/my_other_test_avg',
|
| + 'tableLayout': '{"my_test_suite/my_test_avg": ["Foreground", '
|
| + '"Pretty Name 1"], "my_test_suite/my_other_test_avg": '
|
| + '["Foreground", "Pretty Name 2"]}',
|
| }
|
|
|
| class CreateHealthReportTest(testing_common.TestCase):
|
| @@ -48,6 +49,13 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| graph_data.Bot(
|
| id='linux', parent=master_key, internal_only=True).put()
|
|
|
| + self._AddTests() # This function seems to break the internal_only of the
|
| + # bots, so the below fixes it.
|
| + bots = graph_data.Bot.query().fetch()
|
| + for bot in bots:
|
| + bot.internal_only = True
|
| + bot.put()
|
| +
|
| def _AddMixedBotsToDataStore(self):
|
| """Adds sample bot/master pairs."""
|
| master_key = ndb.Key('Master', 'ChromiumPerf')
|
| @@ -56,6 +64,12 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| graph_data.Bot(
|
| id='linux', parent=master_key, internal_only=True).put()
|
|
|
| + self._AddTests()# This function seems to break the internal_only of the
|
| + # bots, so the below fixes it for linux only.
|
| + bots = graph_data.Bot.query().fetch()
|
| + bots[1].internal_only = True
|
| + bots[1].put()
|
| +
|
| def _AddPublicBotsToDataStore(self):
|
| """Adds sample bot/master pairs."""
|
| master_key = ndb.Key('Master', 'ChromiumPerf')
|
| @@ -63,6 +77,15 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| id='win', parent=master_key, internal_only=False).put()
|
| graph_data.Bot(
|
| id='linux', parent=master_key, internal_only=False).put()
|
| + self._AddTests()
|
| +
|
| + def _AddTests(self):
|
| + testing_common.AddTests(['ChromiumPerf'], ['win', 'linux'], {
|
| + 'my_test_suite': {
|
| + 'my_test_avg': {},
|
| + 'my_other_test_avg': {},
|
| + }
|
| + })
|
|
|
| def testPost_NoXSRFToken_Returns403Error(self):
|
| self.testapp.post('/create_health_report', {
|
| @@ -97,7 +120,7 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| self.assertTrue(table_entity.internal_only)
|
| self.assertEqual('internal@chromium.org', table_entity.username)
|
| self.assertEqual(
|
| - ['my_test_suite/my_test_*', 'my_test_suite/my_other_test_*'],
|
| + ['my_test_suite/my_test_avg', 'my_test_suite/my_other_test_avg'],
|
| table_entity.tests)
|
| master_key = ndb.Key('Master', 'ChromiumPerf')
|
| win_bot = graph_data.Bot(
|
| @@ -107,8 +130,9 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| bots = [win_bot, linux_bot]
|
| self.assertEqual(bots, table_entity.bots)
|
| self.assertEqual(
|
| - '{ "system_health.memory_mobile/foreground/ashmem":'
|
| - '["Foreground", "Ashmem"]}', table_entity.table_layout)
|
| + '{"my_test_suite/my_test_avg": ["Foreground", "Pretty Name 1"], '
|
| + '"my_test_suite/my_other_test_avg": ["Foreground", "Pretty Name 2"]}',
|
| + table_entity.table_layout)
|
|
|
| def testPost_EmptyForm(self):
|
| response = self.testapp.post('/create_health_report', {
|
| @@ -134,7 +158,7 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| response = self.testapp.post('/create_health_report', {
|
| 'tableName': 'myName',
|
| 'tableBots': 'garbage/moarGarbage',
|
| - 'tableTests': 'someTests_*',
|
| + 'tableTests': 'my_test_suite/my_test_avg',
|
| 'tableLayout': '{"Alayout":"isHere"}',
|
| 'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
|
| })
|
| @@ -166,7 +190,7 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| response = self.testapp.post('/create_health_report', {
|
| 'tableName': 'myName',
|
| 'tableBots': 'ChromiumPerf/linux',
|
| - 'tableTests': 'someTests_*',
|
| + 'tableTests': 'my_test_suite/my_test_avg',
|
| 'tableLayout': 'garbage',
|
| 'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
|
| })
|
| @@ -186,7 +210,7 @@ class CreateHealthReportTest(testing_common.TestCase):
|
| 'tableLayout': '{"Alayout":"isHere"}',
|
| 'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
|
| })
|
| - self.assertIn('someTests does not contain _*.', response)
|
| + self.assertIn('someTests is not a valid test.', response)
|
| query = table_config.TableConfig.query()
|
| table_values = query.fetch()
|
| self.assertEqual(len(table_values), 0)
|
|
|