Ejemplo n.º 1
0
    def testGatherHelpData_GridSwitchesToIDs(self):
        servlet = issuelist.IssueList('req', 'res', services=self.services)
        mr = testing_helpers.MakeMonorailRequest()
        page_data = {'results': [1, 2, 3]}

        # Don't show cue if in issue list mode (the default).
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertNotEqual('showing_ids_instead_of_tiles', help_data['cue'])

        mr.mode = 'grid'
        # Don't show cue if showing already IDs (the default).
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertNotEqual('showing_ids_instead_of_tiles', help_data['cue'])

        mr.cells = 'counts'
        # Don't show cue if showing counts.
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertNotEqual('showing_ids_instead_of_tiles', help_data['cue'])

        mr.cells = 'tiles'
        # Don't show cue if there were <= 1000 results
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertNotEqual('showing_ids_instead_of_tiles', help_data['cue'])

        # Show cue if there are more than 1000 results
        page_data = {'results': [1] * (settings.max_tiles_in_grid + 1)}
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertEqual('showing_ids_instead_of_tiles', help_data['cue'])
Ejemplo n.º 2
0
    def setUp(self):
        self.services = service_manager.Services(
            project=fake.ProjectService(),
            config=fake.ConfigService(),
            usergroup=fake.UserGroupService(),
            issue=fake.IssueService(),
            issue_star=fake.IssueStarService(),
            cache_manager=fake.CacheManager(),
            features=fake.FeaturesService(),
            user=fake.UserService())
        self.servlet = issuelist.IssueList('req',
                                           'res',
                                           services=self.services)
        self.project = self.services.project.TestAddProject('proj')
        self.issue1 = fake.MakeTestIssue(1,
                                         1,
                                         'issue_summary',
                                         'New',
                                         111,
                                         project_name='proj')
        self.services.issue.TestAddIssue(self.issue1)
        self.mr = testing_helpers.MakeMonorailRequest(project=self.project)
        self.mr.project_name = self.project.project_name
        self.mr.auth.effective_ids = {111}
        self.mr.me_user_id = 111

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_memcache_stub()
        self.testbed.init_datastore_v3_stub()
Ejemplo n.º 3
0
    def testGatherHelpData_KeystrokeHelp(self):
        servlet = issuelist.IssueList('req', 'res', services=self.services)
        mr = testing_helpers.MakeMonorailRequest()

        page_data = {'table_data': []}

        # Signed in users see a cue to try "?" to see keyboard shortcuts.
        mr.auth.user_id = 111
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertEqual('dit_keystrokes', help_data['cue'])

        # Anon users do not see the cue.
        mr.auth.user_id = 0
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertEqual(None, help_data['cue'])
Ejemplo n.º 4
0
    def testGatherHelpData_ItalicsMeanDerived(self):
        servlet = issuelist.IssueList('req', 'res', services=self.services)
        mr = testing_helpers.MakeMonorailRequest()

        page_data = {'table_data': []}

        cell = table_view_helpers.TableCell(table_view_helpers.CELL_TYPE_ATTR,
                                            [1, 2, 3],
                                            derived_values=[4, 5, 6])
        page_data_with_derived = {
            'table_data': [table_view_helpers.TableRow([cell])]
        }

        # Users see a cue about italics, iff there are any
        # derived values shown in the list.
        help_data = servlet.GatherHelpData(mr, page_data_with_derived)
        self.assertEqual('italics_mean_derived', help_data['cue'])
        help_data = servlet.GatherHelpData(mr, page_data)
        self.assertNotEqual('italics_mean_derived', help_data['cue'])