示例#1
0
    def test_from_dashboard_for_no_share_id(self):
        """
        Should set the dashboard index list item's shared_url tag to an empty
        string if the dashboard does not have a share id.
        """
        data = mk_dashboard_config_data(share_id='test-share-id')
        del data['share_id']
        dashboard = Dashboard(DashboardConfig(data))

        item = DashboardIndexListItem.from_dashboard(dashboard)
        self.assertEqual(item.shared_url_tag, '')
示例#2
0
    def test_from_dashboard(self):
        """
        Should create a dashboard index list item from a dashboard instance.
        """
        data = mk_dashboard_config_data(share_id='test-share-id')
        dashboard = Dashboard(DashboardConfig(data))
        item = DashboardIndexListItem.from_dashboard(dashboard)

        self.assertEqual(item.url, '/some-dashboard')
        self.assertEqual(item.title, 'Some Dashboard')

        self.assertEqual(item.shared_url_tag.tagName, 'a')

        self.assertEqual(
            item.shared_url_tag.children[0],
            '/shared/test-share-id')

        self.assertEqual(
            item.shared_url_tag.attributes['href'],
            '/shared/test-share-id')