Example #1
0
    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)
Example #2
0
    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)
Example #3
0
 def setUp(self):
     super(TestUserNodes, self).setUp()
     self.user_one = UserFactory.build()
     self.user_one.set_password('justapoorboy')
     self.user_one.social['twitter'] = 'howtopizza'
     self.user_one.save()
     self.auth_one = (self.user_one.username, 'justapoorboy')
     self.user_two = UserFactory.build()
     self.user_two.set_password('justapoorboy')
     self.user_two.save()
     self.auth_two = (self.user_two.username, 'justapoorboy')
     self.public_project_user_one = ProjectFactory(title="Public Project User One",
                                                   is_public=True,
                                                   creator=self.user_one)
     self.private_project_user_one = ProjectFactory(title="Private Project User One",
                                                    is_public=False,
                                                    creator=self.user_one)
     self.public_project_user_two = ProjectFactory(title="Public Project User Two",
                                                   is_public=True,
                                                   creator=self.user_two)
     self.private_project_user_two = ProjectFactory(title="Private Project User Two",
                                                    is_public=False,
                                                    creator=self.user_two)
     self.deleted_project_user_one = FolderFactory(title="Deleted Project User One",
                                                   is_public=False,
                                                   creator=self.user_one,
                                                   is_deleted=True)
     self.folder = FolderFactory()
     self.deleted_folder = FolderFactory(title="Deleted Folder User One",
                                         is_public=False,
                                         creator=self.user_one,
                                         is_deleted=True)
     self.dashboard = DashboardFactory()
Example #4
0
    def setUp(self):
        super(TestUserRoutesNodeRoutes, self).setUp()
        self.user_one = AuthUserFactory()
        self.user_one.social['twitter'] = 'howtopizza'
        self.user_two = AuthUserFactory()
        self.public_project_user_one = ProjectFactory(
            title="Public Project User One",
            is_public=True,
            creator=self.user_one)
        self.private_project_user_one = ProjectFactory(
            title="Private Project User One",
            is_public=False,
            creator=self.user_one)
        self.public_project_user_two = ProjectFactory(
            title="Public Project User Two",
            is_public=True,
            creator=self.user_two)
        self.private_project_user_two = ProjectFactory(
            title="Private Project User Two",
            is_public=False,
            creator=self.user_two)
        self.deleted_project_user_one = FolderFactory(
            title="Deleted Project User One",
            is_public=False,
            creator=self.user_one,
            is_deleted=True)

        self.folder = FolderFactory()
        self.deleted_folder = FolderFactory(title="Deleted Folder User One",
                                            is_public=False,
                                            creator=self.user_one,
                                            is_deleted=True)
        self.dashboard = DashboardFactory()
    def setUp(self):
        super(TestRegistrationFiltering, self).setUp()
        self.user_one = AuthUserFactory()
        self.user_two = AuthUserFactory()
        self.project_one = ProjectFactory(title="Project One",
                                          description='Two',
                                          is_public=True,
                                          creator=self.user_one,
                                          category='hypothesis')
        self.project_two = ProjectFactory(title="Project Two",
                                          description="One Three",
                                          is_public=True,
                                          creator=self.user_one)
        self.project_three = ProjectFactory(title="Three",
                                            is_public=True,
                                            creator=self.user_two)

        self.private_project_user_one = ProjectFactory(
            title="Private Project User One",
            is_public=False,
            creator=self.user_one)
        self.private_project_user_two = ProjectFactory(
            title="Private Project User Two",
            is_public=False,
            creator=self.user_two)

        self.project_one.add_tag('tag1',
                                 Auth(self.project_one.creator),
                                 save=False)
        self.project_one.add_tag('tag2',
                                 Auth(self.project_one.creator),
                                 save=False)
        self.project_one.save()
        self.project_two.add_tag('tag1',
                                 Auth(self.project_two.creator),
                                 save=True)
        self.project_two.save()

        self.project_one_reg = RegistrationFactory(creator=self.user_one,
                                                   project=self.project_one,
                                                   is_public=True)
        self.project_two_reg = RegistrationFactory(creator=self.user_one,
                                                   project=self.project_two,
                                                   is_public=True)
        self.project_three_reg = RegistrationFactory(
            creator=self.user_two, project=self.project_three, is_public=True)
        self.private_project_user_one_reg = RegistrationFactory(
            creator=self.user_one,
            project=self.private_project_user_one,
            is_public=False)
        self.private_project_user_two_reg = RegistrationFactory(
            creator=self.user_two,
            project=self.private_project_user_two,
            is_public=False)

        self.folder = FolderFactory()
        self.dashboard = DashboardFactory()

        self.url = "/{}registrations/".format(API_BASE)
Example #6
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)
Example #7
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)
Example #8
0
 def setUp(self):
     super(TestSmartFolderViews, self).setUp()
     self.dash = DashboardFactory()
     self.user = self.dash.creator
     self.auth = AuthFactory(user=self.user)
Example #9
0
 def setUp(self):
     super(TestSerializingEmptyDashboard, self).setUp()
     self.dash = DashboardFactory()
     self.auth = AuthFactory(user=self.dash.creator)
     self.dash_hgrid = rubeus.to_project_hgrid(self.dash, self.auth)