本文整理汇总了Python中integration.ggrc.TestCase.clear_data方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.clear_data方法的具体用法?Python TestCase.clear_data怎么用?Python TestCase.clear_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类integration.ggrc.TestCase
的用法示例。
在下文中一共展示了TestCase.clear_data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUp(self):
"""Set up test cases for all tests."""
TestCase.clear_data()
self._generate_cad()
response = self._import_file("sorting_with_ca_setup.csv")
self._check_csv_response(response, {})
self.client.get("/login")
示例2: setUp
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUp(self):
"""Imports test_csvs/audit_rbac_snapshot_create.csv needed by the tests"""
TestCase.clear_data()
self.api = Api()
self.objgen = integration.ggrc.generator.ObjectGenerator()
self.csv_files = itertools.cycle([
"audit_rbac_snapshot_create.csv",
"audit_rbac_snapshot_update.csv"
])
self._import_file(next(self.csv_files))
self.people = all_models.Person.eager_query().all()
self.program = db.session.query(all_models.Program).filter(
all_models.Program.slug == "PMRBACPROGRAM-1"
).one()
sources = set(r.source for r in self.program.related_sources)
destinations = set(r.destination
for r in self.program.related_destinations)
related = [obj for obj in sources.union(destinations)
if not isinstance(obj, all_models.Person)]
self.related_objects = related
self.api = Api()
self.client.get("/login")
self.audit = self.create_audit()
self.snapshots = all_models.Snapshot.eager_query().all()
self.sanity_check()
示例3: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
"""Prepare data needed to run the tests"""
TestCase.clear_data()
cls.response = cls._import_file("audit_rbac.csv")
with app.app_context():
cls.people = {
person.name: person
for person in all_models.Person.eager_query().all()
}
created_objects = (
(all_models.Audit, all_models.Audit.slug == 'AUDIT-1', 'audit'),
(all_models.Audit,
all_models.Audit.slug == 'AUDIT-2', 'archived_audit'),
(all_models.Issue, all_models.Issue.slug == 'PMRBACISSUE-1',
'issue'),
(all_models.Issue, all_models.Issue.slug == 'PMRBACISSUE-2',
'archived_issue'),
(all_models.Assessment,
all_models.Assessment.slug == 'PMRBACASSESSMENT-1', 'assessment'),
(all_models.Assessment,
all_models.Assessment.slug == 'PMRBACASSESSMENT-2',
'archived_assessment')
)
for obj, cond, name in created_objects:
setattr(cls, name, obj.eager_query().filter(cond).first())
revision = all_models.Revision.query.filter(
all_models.Revision.resource_type == 'Objective').first()
cls.rev_id = revision.id
# Create snapshot objects:
for audit, name in ((cls.audit, 'snapshot'),
(cls.archived_audit, 'archived_snapshot')):
setattr(cls, name, factories.SnapshotFactory(
child_id=revision.resource_id,
child_type=revision.resource_type,
revision=revision,
parent=audit,
context=audit.context,
))
# Create asessment template objects:
for audit, name in ((cls.audit, 'template'),
(cls.archived_audit, 'archived_template')):
template = factories.AssessmentTemplateFactory(
context=audit.context,
)
factories.RelationshipFactory(
source=audit,
destination=template,
context=audit.context
)
setattr(cls, name, template)
# Refresh objects in the session
for obj in db.session:
db.session.refresh(obj)
示例4: setUp
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUp(self):
"""Set up test cases for all tests."""
TestCase.clear_data()
self._assessment_with_date = None
self._assessment_with_text = None
self._generate_special_assessments()
self._generate_cad()
self._import_file("sorting_with_ca_setup.csv")
self.client.get("/login")
示例5: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
TestCase.clear_data()
cls.response = cls._import_file("audit_rbac.csv")
cls.people = all_models.Person.eager_query().all()
cls.audit = all_models.Audit.eager_query().first()
sources = set(r.source for r in cls.audit.related_sources)
destinations = set(r.destination for r in cls.audit.related_destinations)
related = [obj for obj in sources.union(destinations)
if not isinstance(obj, all_models.Person)]
cls.related_objects = related
示例6: setUp
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUp(self):
"""Prepare data needed to run the tests"""
TestCase.clear_data()
self.api = Api()
self.client.get("/login")
self.archived_audit = factories.AuditFactory(
archived=True
)
self.archived_audit.context = factories.ContextFactory(
name="Audit context",
related_object=self.archived_audit,
)
self.audit = factories.AuditFactory()
self.assessment = factories.AssessmentFactory()
示例7: setUp
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUp(self):
TestCase.clear_data()
super(TestSortingQuery, self).setUp()
self.client.get("/login")
示例8: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
"""Set up test cases for all tests."""
TestCase.clear_data()
# This imported file could be simplified a bit to speed up testing.
cls.response = cls._import_file("people_order.csv")
示例9: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
TestCase.clear_data()
cls.response = TestCase._import_file("import_comments.csv")
示例10: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
"""Set up test cases for all tests."""
TestCase.clear_data()
cls._generate_cad()
cls.response = cls._import_file("querying_with_unicode.csv")
示例11: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(self):
"""Set up test cases for all tests."""
TestCase.clear_data()
self._generate_cad()
self._import_file("querying_with_unicode.csv")
示例12: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
TestCase.clear_data()
cls._import_file("data_for_export_testing.csv")
示例13: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls): # pylint: disable=C0103
TestCase.clear_data()
cls.tc = app.test_client()
cls.tc.get("/login")
cls.import_file("workflow_big_sheet.csv")
示例14: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
"""Set up test cases for all tests."""
TestCase.clear_data()
# This imported file could be simplified a bit to speed up testing.
cls._import_file("data_for_export_testing.csv")
示例15: setUpClass
# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
def setUpClass(cls):
TestCase.clear_data()