當前位置: 首頁>>代碼示例>>Python>>正文


Python models.Organisation類代碼示例

本文整理匯總了Python中titan.projects.models.Organisation的典型用法代碼示例。如果您正苦於以下問題:Python Organisation類的具體用法?Python Organisation怎麽用?Python Organisation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Organisation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_0020_tasklists_post1

 def test_0020_tasklists_post1(self):
     """
     Test post with logged in and invalid organisation slug
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     team = Team(
         name="Developers", organisation=organisation,
         members=[self.user]
     )
     team.save()
     acl = AccessControlList(team=team, role="admin")
     project = Project(
         name="titan", organisation=organisation, acl=[acl],
         slug=slugify('titan project')
     )
     project.save()
     response = self.fetch(
         '/an-invalid-organisation/%s/tasklists' % project.slug,
         method="POST",
         follow_redirects=False,
         body=urlencode({'name': "Version 0.1"}),
         headers={'Cookie': self.get_login_cookie()}
     )
     self.assertEqual(response.code, 404)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:27,代碼來源:test_tasklist.py

示例2: test_0060_slugverification_2

 def test_0060_slugverification_2(self):
     """
     Verify project slug which already exists under current organisations
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     team = Team(
         name="Developers", organisation=organisation,
         members=[self.user]
     )
     team.save()
     acl = AccessControlList(team=team, role="admin")
     project = Project(
         name="titan", organisation=organisation, acl=[acl],
         slug=slugify('titan project')
     )
     project.save()
     response = self.fetch(
         '/%s/+slug-check' % organisation.slug,
         method="POST",
         follow_redirects=False,
         body=urlencode({
             'project_slug':slugify('titan project')
         }),
         headers= {'Cookie' : self.get_login_cookie()}
     )
     response = json.loads(response.body)
     self.assertEqual(response, False)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:30,代碼來源:test_projects.py

示例3: test_0160_task_handler_post_5

    def test_0160_task_handler_post_5(self):
        """
        Test TaskHandler 'post' method invalid form fields
        """
	organisation = Organisation(
            name="open labs", slug=slugify("open labs")
        )
	organisation.save()
        team = Team(
            name="Developers", organisation=organisation,
            members=[self.user]
        )
        team.save()
        acl = AccessControlList(team=team, role="admin")
        project = Project(
            name="titan", organisation=organisation, acl=[acl],
            slug=slugify('titan project')
        )
        project.save()
        tasklist = TaskList(name="version 01", project=project)
        tasklist.save()

        response = self.fetch(
            '/%s/%s/%s/tasks/new' % (
                organisation.slug, project.slug, tasklist.sequence
            ),
            method="POST",
            follow_redirects=False,
            body=urlencode({
                    "status": "new",
                    "assigned_to": str(self.user.id),
            }),
            headers={'Cookie': self.get_login_cookie()},
        )
        self.assertEqual(response.code, 200)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:35,代碼來源:test_tasklist.py

示例4: test_0090_task_handler_get_1

    def test_0090_task_handler_get_1(self):
        """
        Try to render a particular task without being logged in
        """
        organisation = Organisation(
            name="open labs", slug=slugify("open labs")
        )
        organisation.save()
        team = Team(
            name="Developers", organisation=organisation,
            members=[self.user]
        )
        team.save()
        acl = AccessControlList(team=team, role="admin")
        project = Project(
            name="titan", organisation=organisation, acl=[acl],
            slug=slugify('titan project')
        )
        project.save()
        tasklist = TaskList(name="version 01", project=project)
        tasklist.save()

        response = self.fetch(
            '/%s/%s/%s/tasks/new' % (
                organisation.slug, project.slug, tasklist.sequence
            ),
            method="GET",
            follow_redirects=False,
        )
        self.assertEqual(response.code, 302)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:30,代碼來源:test_tasklist.py

示例5: test_0100_task_handler_get_2

    def test_0100_task_handler_get_2(self):
        """
        Try to render a particular task without providing Task Id
        If 'task id' is not provided, then it will return create task form.
        """
        organisation = Organisation(
            name="open labs", slug=slugify("open labs")
        )
        organisation.save()
        team = Team(
            name="Developers", organisation=organisation,
            members=[self.user]
        )
        team.save()
        acl = AccessControlList(team=team, role="admin")
        project = Project(
            name="titan", organisation=organisation, acl=[acl],
            slug=slugify('titan project')
        )
        project.save()
        tasklist = TaskList(name="version 01", project=project)
        tasklist.save()

        response = self.fetch(
            '/%s/%s/%s/tasks/new' % (
                organisation.slug, project.slug, tasklist.sequence
            ),
            method="GET",
            follow_redirects=False,
            headers={'Cookie': self.get_login_cookie()}
        )
        self.assertEqual(response.code, 200)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:32,代碼來源:test_tasklist.py

示例6: test_0080_tasklist_get_1

 def test_0080_tasklist_get_1(self):
     """
     Test Task List with wrong organisation slug
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     team = Team(
         name="Developers", organisation=organisation,
         members=[self.user]
     )
     team.save()
     acl = AccessControlList(team=team, role="admin")
     project = Project(
         name="titan", organisation=organisation, acl=[acl],
         slug=slugify('titan project')
     )
     project.save()
     tasklist = TaskList(name="version 01", project=project)
     tasklist.save()
     response = self.fetch(
         '/wrong-organisation/%s/%s' % (project.slug, tasklist.sequence),
         method="GET",
         follow_redirects=False,
         headers={'Cookie': self.get_login_cookie()}
     )
     self.assertEqual(response.code, 404)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:28,代碼來源:test_tasklist.py

示例7: test_0070_projecthandler_1

 def test_0070_projecthandler_1(self):
     """
     Test project page which already exist
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     team = Team(
         name="Developers", organisation=organisation,
         members=[self.user]
     )
     team.save()
     acl = AccessControlList(team=team, role="admin")
     project = Project(
         name="titan", organisation=organisation, acl=[acl],
         slug=slugify('titan project')
     )
     project.save()
     response = self.fetch(
         '/%s/%s' % (organisation.slug, project.slug),
         method="GET",
         follow_redirects=False,
         headers= {'Cookie' : self.get_login_cookie()}
     )
     self.assertEqual(response.code, 200)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:26,代碼來源:test_projects.py

示例8: test_0040_projects_post_2

 def test_0040_projects_post_2(self):
     """
     post with logged in and Project slug already exist
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     team = Team(
         name="Developers", organisation=organisation,
         members=[self.user]
     )
     team.save()
     acl = AccessControlList(team=team, role="admin")
     project = Project(
         name="titan", organisation=organisation, acl=[acl],
         slug=slugify('titan project')
     )
     project.save()
     response = self.fetch(
         '/%s/projects/' % organisation.slug,
         method="POST",
         follow_redirects=False,
         body=urlencode({'name':'Titan', 'slug':slugify('titan project')}),
         headers= {'Cookie' : self.get_login_cookie()}
     )
     self.assertEqual(response.code, 200)
     self.assertEqual(
         response.body.count(
             u'A project with the same short code already exists'
         ), 1
     )
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:32,代碼來源:test_projects.py

示例9: test_0010_create_organisation

 def test_0010_create_organisation(self):
     """
     Create an Organisation
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     self.assertEqual(Organisation.objects().count(), 1)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:9,代碼來源:test_model.py

示例10: tearDown

 def tearDown(self):
     """
     Drop each collection after each test.
     """
     User.drop_collection()
     Organisation.drop_collection()
     Team.drop_collection()
     Project.drop_collection()
     Task.drop_collection()
     TaskList.drop_collection()
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:10,代碼來源:test_model.py

示例11: test_0020_unique_slug

 def test_0020_unique_slug(self):
     """
     'slug' must be a unique value in Organisation.
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     organisation = Organisation(name="open lab", slug=slugify("open labs"))
     self.assertRaises(OperationError, organisation.save)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:10,代碼來源:test_model.py

示例12: test_0040_create_team

 def test_0040_create_team(self):
     """
     Create a Team
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     team = Team(
         name="Developers", organisation=organisation, members=[self.user]
     )
     team.save()
     self.assertEqual(Team.objects().count(), 1)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:13,代碼來源:test_model.py

示例13: test_0070_create_project

 def test_0070_create_project(self):
     """
     Create project under organisation
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     project = create_project(
         self.user, "Titan", "titan project", organisation
     )
     project.save()
     self.assertEqual(Project.objects().count(), 1)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:13,代碼來源:test_model.py

示例14: test_0110_create_tasklist

 def test_0110_create_tasklist(self):
     """
     Create task list under project
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     project = create_project(
         self.user, 'Titan', 'titan project', organisation
     )
     project.save()
     task_list = TaskList(name="Version 0.1", project=project)
     task_list.save()
     self.assertEqual(TaskList.objects().count(), 1)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:15,代碼來源:test_model.py

示例15: test_0080_unique_slug

 def test_0080_unique_slug(self):
     """
     project "slug" must be unique under the current organisation
     """
     organisation = Organisation(
         name="open labs", slug=slugify("open labs")
     )
     organisation.save()
     project = create_project(
         self.user, "New Titan", "titan projects", organisation
     )
     project.save()
     project = create_project(
         self.user, "New Titan", "titan projects", organisation
     )
     self.assertRaises(ValidationError, project.save)
開發者ID:Anoopsmohan,項目名稱:titan,代碼行數:16,代碼來源:test_model.py


注:本文中的titan.projects.models.Organisation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。