Пример #1
0
 def test_build_cloud_empty(self):
     dbStub.reset()
     dbStub.addResult([])
     t = Tags()
     data = t.build_cloud()
     self.assertFalse(data)
     self.assertTrue(dbStub.closed)
Пример #2
0
 def test_tag_id_empty(self):
     dbStub.reset()
     dbStub.addResult([])
     t = Tags()
     tag_id = t.tag_id('testi')
     self.assertEquals(tag_id, None)
     self.assertTrue(dbStub.closed)
Пример #3
0
 def setUp(self):
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     userstoreStub.user.username = '******'
     userstoreStub.user.authorization_key = 1
     userstoreStub.user.organization_keys = [ 1 ]
     dbStub.addResult([[1]])
Пример #4
0
 def test_do(self):
     dbStub.addResult([])
     command = multiproject.common.projects.commands.ListUpProject(self.projectObj)
     self.assertFalse(command.success)
     self.assertTrue(command.do())
     self.assertTrue(command.success)
     self.assertTrue(dbStub.closed)
Пример #5
0
 def setUp(self):
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = 'path'  # dummy env.path
     self.save_called = False
     self.updateset = {}
     dbStub.addResult([[]])
Пример #6
0
 def test_tag_id_empty(self):
     dbStub.reset()
     dbStub.addResult([])
     t = Tags()
     tag_id = t.tag_id('testi')
     self.assertEquals(tag_id, None)
     self.assertTrue(dbStub.closed)
Пример #7
0
 def setUp(self):
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = 'path' # dummy env.path
     self.save_called = False
     self.updateset = {}
     dbStub.addResult([[]])
Пример #8
0
 def test_build_cloud_empty(self):
     dbStub.reset()
     dbStub.addResult([])
     t = Tags()
     data = t.build_cloud()
     self.assertFalse(data)
     self.assertTrue(dbStub.closed)
Пример #9
0
 def test_build_project_tags_empty(self):
     dbStub.reset()
     dbStub.addResult([])
     t = Tags()
     data = t.build_project_tags(0)
     self.assertFalse(data)
     self.assertTrue(dbStub.closed)
Пример #10
0
 def setUp(self):
     # tag_id, tag_name, tag_count
     dbStub.addResult([
         [1, 'joo', 150],
         [2, 'ei', 30],
         [3, 'kissanviikset', 1]
     ])
Пример #11
0
 def test_build_project_tags_empty(self):
     dbStub.reset()
     dbStub.addResult([])
     t = Tags()
     data = t.build_project_tags(0)
     self.assertFalse(data)
     self.assertTrue(dbStub.closed)
Пример #12
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
Пример #13
0
 def test_do(self):
     dbStub.addResult([])
     command = multiproject.common.projects.commands.ListUpProject(
         self.projectObj)
     self.assertFalse(command.success)
     self.assertTrue(command.do())
     self.assertTrue(command.success)
     self.assertTrue(dbStub.closed)
Пример #14
0
 def test_searchProjects(self):
     dbStub.addResult(project_search_result)
     g = multiproject.common.xmlrpc.ProjectsRPC(self.cm)
     result = g.searchProjects(self, 'project', 'category_not_used')
     self.assertEquals(len(result), 3)
     self.assertEquals(result[0], 'project1|Project 1')
     self.assertEquals(result[1], 'project2|Project 2')
     self.assertEquals(result[2], 'project3|Project 3')
     self.assertTrue(dbStub.closed)
Пример #15
0
    def test_project_environment_does_not_exist(self):
        dbStub.addResult([[0]])
        p = Projects()
        self.assertFalse(p.project_environment_exists("testi"))
        self.assertTrue(dbStub.closed)

        dbStub.setExceptions(True)
        self.assertFalse(p.project_environment_exists("testi"))
        self.assertTrue(dbStub.closed)
Пример #16
0
 def test_searchProjects(self):
     dbStub.addResult(project_search_result)
     g = multiproject.common.xmlrpc.ProjectsRPC(self.cm)
     result = g.searchProjects(self, 'project', 'category_not_used')
     self.assertEquals(len(result), 3)
     self.assertEquals(result[0], 'project1|Project 1')
     self.assertEquals(result[1], 'project2|Project 2')
     self.assertEquals(result[2], 'project3|Project 3')
     self.assertTrue(dbStub.closed)
Пример #17
0
    def test_project_environment_does_not_exist(self):
        dbStub.addResult([ [0] ])
        p = Projects()
        self.assertFalse(p.project_environment_exists("testi"))
        self.assertTrue(dbStub.closed)

        dbStub.setExceptions(True)
        self.assertFalse(p.project_environment_exists("testi"))
        self.assertTrue(dbStub.closed)
Пример #18
0
 def test_save(self):
     # Set organization id
     dbStub.addResult([[1]])
     self.setUp_save()
     p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
     p.env = self; p.env.log = self
     page, data = p.render_admin_panel(self.req, None, None, None)
     self.assertEquals(page, 'admin_edit.html')
     self.assertEquals(data['msg'], "User somebody updated!")
Пример #19
0
 def test_get_my_tasks(self):
     dbStub.addResult(project_tasks_result)
     p = Projects()
     project_list = [
         Project(1, "project1", "project1", "Project 1", 1, "2010-01-01"),
         Project(2, "project2", "project2", "Project 2", 2, "2010-01-02")
     ]
     tasks = p.get_all_user_tasks("username", project_list)
     self.assertEquals(len(tasks), 6)
     self.assertTrue(dbStub.closed)
Пример #20
0
 def test_get_my_tasks(self):
     dbStub.addResult(project_tasks_result)
     p = Projects()
     project_list = [
         Project(1, "project1", "project1", "Project 1", 1, "2010-01-01"),
         Project(2, "project2", "project2", "Project 2", 2, "2010-01-02")
     ]
     tasks = p.get_all_user_tasks("username", project_list)
     self.assertEquals(len(tasks), 6)
     self.assertTrue(dbStub.closed)
Пример #21
0
 def test_save(self):
     # Set organization id
     dbStub.addResult([[1]])
     self.setUp_save()
     p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
     p.env = self
     p.env.log = self
     page, data = p.render_admin_panel(self.req, None, None, None)
     self.assertEquals(page, 'admin_edit.html')
     self.assertEquals(data['msg'], "User somebody updated!")
Пример #22
0
 def test_edit(self):
     # Set organization id
     dbStub.addResult([[1]])
     self.req.args['username'] = '******'
     userstoreStub.user.givenName = "somebody"
     p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
     p.env = self; p.env.log = self
     page, data = p.render_admin_panel(self.req, None, None, None)
     self.assertEquals(page, 'admin_edit.html')
     self.assertEquals(data['first'], "somebody")
Пример #23
0
 def test_search_user_projects(self):
     dbStub.addResult(project_search_result)
     p = Projects()
     userstoreStub.user.username = "******"
     projects = p.searchUserProjects("name1 name2 name3","user")
     self.assertEquals(len(projects), 3)
     self.assertEquals(projects[0].env_name, 'project1')
     self.assertEquals(projects[0].project_name, 'Project 1')
     self.assertEquals(projects[0].author_id, 10)
     self.assertEquals(projects[0].created, '2009-01-01')
     self.assertTrue(dbStub.closed)
Пример #24
0
 def setUp(self):
     dbStub.addResult([[1]])
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = "/tmp"  # dummy env.path
     self.project_name = "tmp"
     self.orig_create_project = multiproject.common.projects.api.Projects.create_project
     self.orig_remove_project = multiproject.common.projects.api.Projects.remove_project
     self.orig_get_project = multiproject.common.projects.api.Projects.get_project
     self.orig_is_superuser = multiproject.core.permissions.CQDESuperUserStore.is_superuser
Пример #25
0
    def test_save_error_confirm_password(self):
        # Set organization id
        dbStub.addResult([[1]])
        self.setUp_save()
        p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
        p.env = self; p.env.log = self

        self.req.args['confirmpw'] = "asdf"
        page, data = p.render_admin_panel(self.req, None, None, None)
        self.assertEquals(page, 'admin_edit.html')
        self.assertEquals(data['msg'], "Passwords don't match!")
Пример #26
0
    def test_save_error_missing_email(self):
        # Set organization id
        dbStub.addResult([[1]])
        self.setUp_save()
        p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
        p.env = self; p.env.log = self

        self.req.args['email'] = ""
        page, data = p.render_admin_panel(self.req, None, None, None)
        self.assertEquals(page, 'admin_edit.html')
        self.assertEquals(data['msg'], "E-mail address required")
Пример #27
0
 def test_edit(self):
     # Set organization id
     dbStub.addResult([[1]])
     self.req.args['username'] = '******'
     userstoreStub.user.givenName = "somebody"
     p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
     p.env = self
     p.env.log = self
     page, data = p.render_admin_panel(self.req, None, None, None)
     self.assertEquals(page, 'admin_edit.html')
     self.assertEquals(data['first'], "somebody")
Пример #28
0
 def setUp(self):
     dbStub.addResult([[1]])
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = '/tmp' # dummy env.path
     self.project_name = "tmp"
     self.orig_create_project = multiproject.common.projects.api.Projects.create_project
     self.orig_remove_project = multiproject.common.projects.api.Projects.remove_project
     self.orig_get_project = multiproject.common.projects.api.Projects.get_project
     self.orig_is_superuser = multiproject.core.permissions.CQDESuperUserStore.is_superuser
Пример #29
0
 def test_search_user_projects(self):
     dbStub.addResult(project_search_result)
     p = Projects()
     userstoreStub.user.username = "******"
     projects = p.searchUserProjects("name1 name2 name3", "user")
     self.assertEquals(len(projects), 3)
     self.assertEquals(projects[0].env_name, 'project1')
     self.assertEquals(projects[0].project_name, 'Project 1')
     self.assertEquals(projects[0].author_id, 10)
     self.assertEquals(projects[0].created, '2009-01-01')
     self.assertTrue(dbStub.closed)
Пример #30
0
 def setUp(self):
     dbStub.addResult([[1]]) # project id
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = 'path' # dummy env.path
     self.project_name = "path"
     self.project_description = "description"
     trac.admin.web_ui.BasicsAdminPanel.render_admin_panel = render
     cache = ProjectCache.instance()
     cache.clearProjectId("path")
     cache.clearProject("path")
Пример #31
0
 def setUp(self):
     dbStub.addResult([[1]])  # project id
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = 'path'  # dummy env.path
     self.project_name = "path"
     self.project_description = "description"
     trac.admin.web_ui.BasicsAdminPanel.render_admin_panel = render
     cache = ProjectCache.instance()
     cache.clearProjectId("path")
     cache.clearProject("path")
Пример #32
0
    def test_save_error_password_length(self):
        # Set organization id
        dbStub.addResult([[1]])
        dbStub.addResult([[1]])
        self.setUp_save()
        p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
        p.env = self; p.env.log = self

        self.req.args['password'] = "******"
        page, data = p.render_admin_panel(self.req, None, None, None)
        self.assertEquals(page, 'admin_edit.html')
        self.assertEquals(data['msg'], "Password should be at least 7 characters long!")
Пример #33
0
    def test_save_error_missing_email(self):
        # Set organization id
        dbStub.addResult([[1]])
        self.setUp_save()
        p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
        p.env = self
        p.env.log = self

        self.req.args['email'] = ""
        page, data = p.render_admin_panel(self.req, None, None, None)
        self.assertEquals(page, 'admin_edit.html')
        self.assertEquals(data['msg'], "E-mail address required")
Пример #34
0
    def test_save_error_confirm_password(self):
        # Set organization id
        dbStub.addResult([[1]])
        self.setUp_save()
        p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
        p.env = self
        p.env.log = self

        self.req.args['confirmpw'] = "asdf"
        page, data = p.render_admin_panel(self.req, None, None, None)
        self.assertEquals(page, 'admin_edit.html')
        self.assertEquals(data['msg'], "Passwords don't match!")
 def setUp(self):
     dbStub.addResult([[1]])
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = "path"  # dummy env.path
     self.project_name = "path"
     self.bind_called = False
     self.unbind_called = False
     self.orig_bind = CQDECategoryStore().bind_category_project  # @UndefinedVariable
     self.orig_unbind = CQDECategoryStore().unbind_category_project  # @UndefinedVariable
     CQDECategoryStore().bind_category_project = self.bind
     CQDECategoryStore().unbind_category_project = self.unbind
Пример #36
0
    def test_save_error_password_length(self):
        # Set organization id
        dbStub.addResult([[1]])
        dbStub.addResult([[1]])
        self.setUp_save()
        p = multiproject.home.admin.users.EditUsersAdminPanel(self.cm)
        p.env = self
        p.env.log = self

        self.req.args['password'] = "******"
        page, data = p.render_admin_panel(self.req, None, None, None)
        self.assertEquals(page, 'admin_edit.html')
        self.assertEquals(data['msg'],
                          "Password should be at least 7 characters long!")
 def setUp(self):
     dbStub.addResult([[1]])
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = 'path'  # dummy env.path
     self.project_name = "path"
     self.bind_called = False
     self.unbind_called = False
     self.orig_bind = CQDECategoryStore(
     ).bind_category_project  #@UndefinedVariable
     self.orig_unbind = CQDECategoryStore(
     ).unbind_category_project  #@UndefinedVariable
     CQDECategoryStore().bind_category_project = self.bind
     CQDECategoryStore().unbind_category_project = self.unbind
Пример #38
0
 def setUp(self):
     dbStub.addResult([[1]])
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = '/trac/tmp'  # dummy env.path
     self.add_called = False
     self.remove_called = False
     self.orig_add = Tags.add  #@UndefinedVariable
     self.orig_remove = Tags.remove  #@UndefinedVariable
     Tags.add = self.add
     Tags.remove = self.remove
     cache = ProjectCache.instance()
     cache.clearProjectId("tmp")
     cache.clearProject("tmp")
Пример #39
0
 def setUp(self):
     dbStub.addResult([[1]])
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = '/trac/tmp' # dummy env.path
     self.add_called = False
     self.remove_called = False
     self.orig_add = Tags.add #@UndefinedVariable
     self.orig_remove = Tags.remove #@UndefinedVariable
     Tags.add = self.add
     Tags.remove = self.remove
     cache = ProjectCache.instance()
     cache.clearProjectId("tmp")
     cache.clearProject("tmp")
Пример #40
0
 def test_getProjectCategories(self):
     dbStub.addResult(test_contexts)
     dbStub.addResult(test_categories)
     dbStub.addResult(test_categories)
     g = multiproject.common.xmlrpc.ProjectsRPC(self.cm)
     result = g.getProjectCategories(self)
     self.assertEquals(len(result), 4)
     self.assertEquals(result[0], "context1")
     self.assertEquals(result[2], "context2")
     self.assertEquals(len(result[1]), 3)
     self.assertEquals(len(result[3]), 3)
     self.assertEquals(result[1][0], "cat1")
     self.assertEquals(result[1][1], "cat2")
     self.assertEquals(result[1][2], "cat3")
Пример #41
0
 def test_getProjectCategories(self):
     dbStub.addResult(test_contexts)
     dbStub.addResult(test_categories)
     dbStub.addResult(test_categories)
     g = multiproject.common.xmlrpc.ProjectsRPC(self.cm)
     result = g.getProjectCategories(self)
     self.assertEquals(len(result), 4)
     self.assertEquals(result[0], "context1")
     self.assertEquals(result[2], "context2")
     self.assertEquals(len(result[1]), 3)
     self.assertEquals(len(result[3]), 3)
     self.assertEquals(result[1][0], "cat1")
     self.assertEquals(result[1][1], "cat2")
     self.assertEquals(result[1][2], "cat3")
Пример #42
0
 def test_is_project_owner_error(self):
     dbStub.addResult([[1]])  # user id
     userstoreStub.user.id = 0
     p = Projects()
     self.assertFalse(p.is_project_owner("project", "nobody"))
     self.assertTrue(dbStub.closed)
Пример #43
0
 def test_getCount(self):
     dbStub.addResult([[198]])
     g = multiproject.common.xmlrpc.ProjectsRPC(self.cm)
     result = g.getCount(self)
     self.assertEquals(result, 198)
Пример #44
0
 def setUp(self):
     self.projectObj = Project(None, 'short_name', 'Long name', 'Desc', 1,
                               None)
     dbStub.addResult([])
Пример #45
0
 def test_getCount(self):
     dbStub.addResult([ [198] ])
     g = multiproject.common.xmlrpc.ProjectsRPC(self.cm)
     result = g.getCount(self)
     self.assertEquals(result, 198)
Пример #46
0
 def test_is_project_owner(self):
     dbStub.addResult([ [1] ]) # user id
     userstoreStub.user.id = 1
     p = Projects()
     self.assertTrue(p.is_project_owner("project", "user"))
     self.assertTrue(dbStub.closed)
Пример #47
0
 def test_projectExists(self):
     dbStub.addResult([ [1] ])
     g = multiproject.common.xmlrpc.ProjectsRPC(self.cm)
     result = g.projectExists(self, 'project2')
     self.assertTrue(result)
     self.assertTrue(dbStub.closed)
Пример #48
0
 def test_project_count(self):
     dbStub.addResult([ [3] ])
     p = Projects()
     self.assertEquals(p.project_count(), 3)
     self.assertTrue(dbStub.closed)
Пример #49
0
 def test_is_project_owner_error(self):
     dbStub.addResult([ [1] ]) # user id
     userstoreStub.user.id = 0
     p = Projects()
     self.assertFalse(p.is_project_owner("project", "nobody"))
     self.assertTrue(dbStub.closed)
Пример #50
0
 def test_project_environment_exists(self):
     dbStub.addResult([ [1] ])
     p = Projects()
     self.assertTrue(p.project_environment_exists("testi"))
     self.assertTrue(dbStub.closed)
Пример #51
0
 def test_is_project_owner(self):
     dbStub.addResult([[1]])  # user id
     userstoreStub.user.id = 1
     p = Projects()
     self.assertTrue(p.is_project_owner("project", "user"))
     self.assertTrue(dbStub.closed)
Пример #52
0
 def setUp(self):
     self.projectObj = Project(None, 'short_name', 'Long name', 'Desc', 1, None)
     dbStub.addResult([])
Пример #53
0
 def setUp(self):
     dbStub.addResult([])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
     self.path = '/tmp'  # dummy env.path
Пример #54
0
 def setUp(self):
     # tag_id, tag_name, tag_count
     dbStub.addResult([[1, 'joo', 150], [2, 'ei', 30],
                       [3, 'kissanviikset', 1]])
Пример #55
0
 def setUp(self):
     conf.use_test_db(False)
     dbStub.addResult([[1, "data", "image/gif"]])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
Пример #56
0
 def test_project_count(self):
     dbStub.addResult([[3]])
     p = Projects()
     self.assertEquals(p.project_count(), 3)
     self.assertTrue(dbStub.closed)
Пример #57
0
 def setUp(self):
     conf.use_test_db(False)
     dbStub.addResult([[1, "data", "image/gif"]])
     self.cm = trac.core.ComponentManager()
     self.req = DummyReq()
Пример #58
0
 def test_project_environment_exists(self):
     dbStub.addResult([[1]])
     p = Projects()
     self.assertTrue(p.project_environment_exists("testi"))
     self.assertTrue(dbStub.closed)