本文整理汇总了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
示例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
示例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