Beispiel #1
0
class TestSerializingPopulatedDashboard(OsfTestCase):


    def setUp(self):
        super(TestSerializingPopulatedDashboard, self).setUp()
        self.dash = DashboardFactory()
        self.user = self.dash.creator
        self.auth = AuthFactory(user=self.user)

        self.init_dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)

    def test_dashboard_adding_one_folder_increases_size_by_one(self):
        folder = FolderFactory(creator=self.user)
        self.dash.add_pointer(folder, self.auth)

        dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)
        assert_equal(len(dash_hgrid), len(self.init_dash_hgrid) + 1)

    def test_dashboard_adding_one_folder_does_not_remove_smart_folders(self):
        folder = FolderFactory(creator=self.user)
        self.dash.add_pointer(folder, self.auth)

        dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)

        assert_true(
            {ALL_MY_PROJECTS_NAME, ALL_MY_REGISTRATIONS_NAME, folder.title} <=
            {node_hgrid['name'] for node_hgrid in dash_hgrid}
        )

    def test_dashboard_adding_one_folder_increases_size_by_one_in_hgrid_representation(self):
        folder = FolderFactory(creator=self.user)
        self.dash.add_pointer(folder, self.auth)

        project = ProjectFactory(creator=self.user)
        folder.add_pointer(project,self.auth)

        dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)
        assert_equal(len(dash_hgrid), len(self.init_dash_hgrid) + 1)
Beispiel #2
0
class TestSerializingPopulatedDashboard(OsfTestCase):


    def setUp(self):
        super(TestSerializingPopulatedDashboard, self).setUp()
        self.dash = DashboardFactory()
        self.user = self.dash.creator
        self.auth = AuthFactory(user=self.user)

        self.init_dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)

    def test_dashboard_adding_one_folder_increases_size_by_one(self):
        folder = FolderFactory(creator=self.user)
        self.dash.add_pointer(folder, self.auth)

        dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)
        assert_equal(len(dash_hgrid), len(self.init_dash_hgrid) + 1)

    def test_dashboard_adding_one_folder_does_not_remove_smart_folders(self):
        folder = FolderFactory(creator=self.user)
        self.dash.add_pointer(folder, self.auth)

        dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)

        assert_true(
            {ALL_MY_PROJECTS_NAME, ALL_MY_REGISTRATIONS_NAME, folder.title} <=
            {node_hgrid['name'] for node_hgrid in dash_hgrid}
        )

    def test_dashboard_adding_one_folder_increases_size_by_one_in_hgrid_representation(self):
        folder = FolderFactory(creator=self.user)
        self.dash.add_pointer(folder, self.auth)

        project = ProjectFactory(creator=self.user)
        folder.add_pointer(project,self.auth)

        dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)
        assert_equal(len(dash_hgrid), len(self.init_dash_hgrid) + 1)