Example #1
0
 def test_undo(self):
     conf.use_test_db(True)
     self.load_fixtures()
     # Prepare
     command = multiproject.common.projects.commands.SetPermissions(self.projectObj)
     # Try undo
     self.assertTrue(command.undo())
 def setUp(self):
     conf.use_test_db(True)
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = '/path/test'
     self.add_called = False
     self.remove_called = False
Example #3
0
 def test_undo(self):
     conf.use_test_db(True)
     self.load_fixtures()
     # Prepare
     command = multiproject.common.projects.commands.SetPermissions(
         self.projectObj)
     # Try undo
     self.assertTrue(command.undo())
Example #4
0
 def setUp(self):
     conf.use_test_db(False)
     dbStub.addResult([['cookiename']])
     self.cm = trac.core.ComponentManager()
     self.cookie = Cookie()
     self.cookie.value = 'cookie'
     self.req = DummyReq()
     self.secure_cookies = True
Example #5
0
    def test_check_permission(self):
        conf.use_test_db(True)
        self.load_fixtures()

        cache = ProjectCache.instance()
        cache.clearProjectId('storageauthtest')
        g = multiproject.common.permissions.GlobalPermissionPolicy(self.cm)
        g.env = self; g.env.log = self
        self.assertTrue(g.check_permission('VERSION_CONTROL_VIEW', 'kenny', None, None))
        self.assertTrue(g.check_permission('VERSION_CONTROL', 'kenny', None, None))
        self.assertFalse(g.check_permission('VERSION_CONTROL', 'cartman', None, None))
Example #6
0
    def setUp(self):
        userObj = User()
        userObj.id = 30
        userObj.username = '******'

        self.projectObj = Project(24, 'storageauthtest', 'Storage auth testing', 'Desc',
                                  userObj.id, None, author = userObj)
        conf.use_test_db(True)
        self.load_fixtures()
        self.store = CQDEUserGroupStore(self.projectObj.id)
        self.store.remove_group('Owners')
        self.store.remove_group('Public contributors')
        self.store.remove_group('Public viewers')
Example #7
0
 def __setUp(self):
     """Setting up the test case"""
     super(BackupRestoreModuleTestCase, self).setUp()
     
     env = self._testenv.get_trac_environment()
     # raises TracError if backup fails
     backup_file = env.backup()
     
     self.assertTrue(os.path.exists(backup_file), 'Backup file was not created.')
     self.assertNotEqual(os.path.getsize(backup_file), 0, 'Backup file is zero length.')
     
     self.env = EnvironmentStub()
     self.cm = trac.core.ComponentManager()
     conf.use_test_db(True)
Example #8
0
    def test_check_permission(self):
        conf.use_test_db(True)
        self.load_fixtures()

        cache = ProjectCache.instance()
        cache.clearProjectId('storageauthtest')
        g = multiproject.common.permissions.GlobalPermissionPolicy(self.cm)
        g.env = self
        g.env.log = self
        self.assertTrue(
            g.check_permission('VERSION_CONTROL_VIEW', 'kenny', None, None))
        self.assertTrue(
            g.check_permission('VERSION_CONTROL', 'kenny', None, None))
        self.assertFalse(
            g.check_permission('VERSION_CONTROL', 'cartman', None, None))
Example #9
0
    def __setUp(self):
        """Setting up the test case"""
        super(BackupRestoreModuleTestCase, self).setUp()

        env = self._testenv.get_trac_environment()
        # raises TracError if backup fails
        backup_file = env.backup()

        self.assertTrue(os.path.exists(backup_file),
                        'Backup file was not created.')
        self.assertNotEqual(os.path.getsize(backup_file), 0,
                            'Backup file is zero length.')

        self.env = EnvironmentStub()
        self.cm = trac.core.ComponentManager()
        conf.use_test_db(True)
    def test_request_when_have_parent(self):
        view = multiproject.project.admin.projectrelations.ProjectForkingAdminPanel(self.cm)
        conf.use_test_db(True)
        self.load_fixtures()

        req = DummyReq("username", "password", "GET", "/trac/cartoons", {})
        req.permissions = ['TRAC_ADMIN']
        view.env = DummyEnv(req)
        page, data = view.render_admin_panel(req, None, None, None)

        self.assertEquals(page, 'admin_relations_panel.html')
        self.assertIn('_project_', data)
        self.assertIn('parent_project', data)
        self.assertIn('child_projects', data)
        self.assertIn('home', data)
        self.assertEquals(len(data['child_projects']), 0)
        self.assertEquals(data['parent_project'].env_name, 'publicroject')
Example #11
0
    def setUp(self):
        userObj = User()
        userObj.id = 30
        userObj.username = '******'

        self.projectObj = Project(24,
                                  'storageauthtest',
                                  'Storage auth testing',
                                  'Desc',
                                  userObj.id,
                                  None,
                                  author=userObj)
        conf.use_test_db(True)
        self.load_fixtures()
        self.store = CQDEUserGroupStore(self.projectObj.id)
        self.store.remove_group('Owners')
        self.store.remove_group('Public contributors')
        self.store.remove_group('Public viewers')
Example #12
0
    def test_request_when_have_parent(self):
        view = multiproject.project.admin.projectrelations.ProjectForkingAdminPanel(
            self.cm)
        conf.use_test_db(True)
        self.load_fixtures()

        req = DummyReq("username", "password", "GET", "/trac/cartoons", {})
        req.permissions = ['TRAC_ADMIN']
        view.env = DummyEnv(req)
        page, data = view.render_admin_panel(req, None, None, None)

        self.assertEquals(page, 'admin_relations_panel.html')
        self.assertIn('_project_', data)
        self.assertIn('parent_project', data)
        self.assertIn('child_projects', data)
        self.assertIn('home', data)
        self.assertEquals(len(data['child_projects']), 0)
        self.assertEquals(data['parent_project'].env_name, 'publicroject')
Example #13
0
 def setUp(self):
     conf.use_test_db(True)
     self.load_fixtures()
     self.cm = trac.core.ComponentManager()
Example #14
0
 def tearDown(self):
     conf.use_test_db(False)
Example #15
0
 def tearDown(self):
     conf.use_test_db(False)
Example #16
0
 def tearDown(self):
     dbStub.reset()
     userstoreStub.reset()
     conf.use_test_db(False)
Example #17
0
 def tearDown(self):
     dbStub.reset()
     userstoreStub.reset()
     conf.use_test_db(False)
Example #18
0
 def setUp(self):
     conf.use_test_db(False)
     dbStub.addResult([[1, "data", "image/gif"]])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
 def tearDown(self):
     conf.use_test_db(False)
     self.cm = None
     self.req = None
Example #20
0
 def tearDown(self):
     self.cm = None
     conf.use_test_db(False)
Example #21
0
 def setUp(self):
     conf.use_test_db(True)
     self.load_fixtures()
     self.cm = trac.core.ComponentManager()
Example #22
0
 def setUp(self):
     conf.use_test_db(False)
     dbStub.addResult([[1, "data", "image/gif"]])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
Example #23
0
 def tearDown(self):
     self.cm = None
     conf.use_test_db(False)