OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is govered by a BSD-style |
| 3 # license that can be found in the LICENSE file or at |
| 4 # https://developers.google.com/open-source/licenses/bsd |
| 5 |
| 6 """Unittests for monorail.project.projectupdates.""" |
| 7 |
| 8 import unittest |
| 9 |
| 10 import mox |
| 11 |
| 12 from features import activities |
| 13 from project import projectupdates |
| 14 from services import service_manager |
| 15 from testing import fake |
| 16 from testing import testing_helpers |
| 17 |
| 18 |
| 19 class ProjectUpdatesTest(unittest.TestCase): |
| 20 |
| 21 def setUp(self): |
| 22 self.services = service_manager.Services(project=fake.ProjectService()) |
| 23 |
| 24 self.project_name = 'proj' |
| 25 self.project_id = 987 |
| 26 self.project = self.services.project.TestAddProject( |
| 27 self.project_name, project_id=self.project_id, |
| 28 process_inbound_email=True) |
| 29 |
| 30 self.mr = testing_helpers.MakeMonorailRequest( |
| 31 services=self.services, project=self.project) |
| 32 self.mr.project_name = self.project_name |
| 33 self.project_updates = projectupdates.ProjectUpdates( |
| 34 None, None, self.services) |
| 35 self.mox = mox.Mox() |
| 36 |
| 37 def tearDown(self): |
| 38 self.mox.UnsetStubs() |
| 39 self.mox.ResetAll() |
| 40 |
| 41 def testGatherPageData(self): |
| 42 self.mox.StubOutWithMock(activities, 'GatherUpdatesData') |
| 43 activities.GatherUpdatesData( |
| 44 self.services, self.mr, mox.IgnoreArg(), project_ids=[self.project_id], |
| 45 ending='by_user', |
| 46 updates_page_url='/p/%s/updates/list' % self.project_name, |
| 47 autolink=self.services.autolink).AndReturn({'test': 'testing'}) |
| 48 self.mox.ReplayAll() |
| 49 |
| 50 page_data = self.project_updates.GatherPageData(self.mr) |
| 51 self.mox.VerifyAll() |
| 52 self.assertEquals( |
| 53 {'subtab_mode': None, 'user_updates_tab_mode': None, 'test': 'testing'}, |
| 54 page_data) |
| 55 |
OLD | NEW |