当前位置: 首页>>代码示例>>Python>>正文


Python Project.document_files方法代码示例

本文整理汇总了Python中app.models.project.Project.document_files方法的典型用法代码示例。如果您正苦于以下问题:Python Project.document_files方法的具体用法?Python Project.document_files怎么用?Python Project.document_files使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app.models.project.Project的用法示例。


在下文中一共展示了Project.document_files方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_logs

# 需要导入模块: from app.models.project import Project [as 别名]
# 或者: from app.models.project.Project import document_files [as 别名]
    def test_logs(self):
        """Test to make sure that logs are being displayed.
        """

        project1 = Project(name="foo", path="/test-path",
            user=self.user)
        project2 = Project(name="foob", path="/foobar",
            user=self.user)

        logs = [WarningLog(log_item="a", item_value="a", project=project1),
            InfoLog(log_item="b", item_value="b", project=project1),
            ErrorLog(log_item="c", item_value="c", project=project1)]

        project1.document_files = [DocumentFile(path="foo")]
        project2.document_files = [DocumentFile(path="foo")]
        project1.save()
        project2.save()

        result = self.client.get("/projects/1")

        assert "alert alert-warning" in result.data
        assert "alert alert-info" in result.data
        assert "alert alert-danger" in result.data
        assert "<em>a</em>: a" in result.data
        assert "<em>b</em>: b" in result.data
        assert "<em>c</em>: c" in result.data
开发者ID:xiaobaozi34,项目名称:wordseer,代码行数:28,代码来源:testuploader.py

示例2: test_process_processed_files

# 需要导入模块: from app.models.project import Project [as 别名]
# 或者: from app.models.project.Project import document_files [as 别名]
    def test_process_processed_files(self):
        """Make sure that a project that's being processed or already
        processed can't be processed again.
        """

        project1 = Project(name="foo", path="/test-path",
            status=Project.STATUS_PREPROCESSING)
        rel = self.user.add_project(project1, role=ProjectsUsers.ROLE_ADMIN)
        document_file = DocumentFile(path="foo/foo.xml")
        structure_file = StructureFile(path="foo/foo.json")
        project1.document_files = [document_file]
        project1.structure_files = [structure_file]
        project1.save()

        data = {
            "struc_id": structure_file.id,
            }

        result = self.client.post(application.config["PROCESS_ROUTE"] + str(project1.id), data=data)

        assert '"status": "OK"' not in result.data

        project1.status = Project.STATUS_DONE
        project1.save()

        result = self.client.post(application.config["PROCESS_ROUTE"] + str(project1.id), data=data)

        assert '"status": "OK"' not in result.data
开发者ID:Wordseer,项目名称:wordseer,代码行数:30,代码来源:testuploader.py

示例3: test_logs

# 需要导入模块: from app.models.project import Project [as 别名]
# 或者: from app.models.project.Project import document_files [as 别名]
    def test_logs(self):
        """Test to make sure that logs are being displayed.
        """

        project1 = Project(name="log test project", path="/log-test-path")
    
        self.user.add_project(project1, role=ProjectsUsers.ROLE_ADMIN)

        logs = [WarningLog(log_item="a", item_value="a", project=project1),
            InfoLog(log_item="b", item_value="b", project=project1),
            ErrorLog(log_item="c", item_value="c", project=project1)]

        project1.document_files = [DocumentFile(path="foo")]
        db.session.add(project1)
        db.session.commit()

        result = self.client.get(application.config["PROJECT_ROUTE"] + str(project1.id))

        print result.data
        assert "log test project" in result.data
        assert "processlog alert alert-warning" in result.data
        assert "processlog alert alert-warning hidden" not in result.data
        assert "processlog alert alert-info" in result.data
        assert "processlog alert alert-info hidden" not in result.data
        assert "processlog alert alert-danger" in result.data
        assert "processlog alert alert-danger hidden" not in result.data
        assert "<em>a</em>: a" in result.data
        assert "<em>b</em>: b" in result.data
        assert "<em>c</em>: c" in result.data
开发者ID:Wordseer,项目名称:wordseer,代码行数:31,代码来源:testuploader.py


注:本文中的app.models.project.Project.document_files方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。