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


Python TestCase.clear_data方法代码示例

本文整理汇总了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")
开发者ID:zidarsk8,项目名称:ggrc-core,代码行数:9,代码来源:test_basic.py

示例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()
开发者ID:VinnieJohns,项目名称:ggrc-core,代码行数:35,代码来源:test_audit_snapshot_rbac.py

示例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)
开发者ID:Smotko,项目名称:ggrc-core,代码行数:59,代码来源:test_audit_archiving.py

示例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")
开发者ID:VinnieJohns,项目名称:ggrc-core,代码行数:11,代码来源:test_query.py

示例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
开发者ID:zidarsk8,项目名称:ggrc-core,代码行数:12,代码来源:test_audit_rbac.py

示例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()
开发者ID:Smotko,项目名称:ggrc-core,代码行数:16,代码来源:test_audit_archiving.py

示例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")
开发者ID:egorhm,项目名称:ggrc-core,代码行数:6,代码来源:test_basic.py

示例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")
开发者ID:Smotko,项目名称:ggrc-core,代码行数:7,代码来源:test_order.py

示例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")
开发者ID:egorhm,项目名称:ggrc-core,代码行数:5,代码来源:test_import_comments.py

示例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")
开发者ID:egorhm,项目名称:ggrc-core,代码行数:7,代码来源:test_basic.py

示例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")
开发者ID:VinnieJohns,项目名称:ggrc-core,代码行数:7,代码来源:test_query.py

示例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")
开发者ID:VinnieJohns,项目名称:ggrc-core,代码行数:5,代码来源:test_export_csv.py

示例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")
开发者ID:VinnieJohns,项目名称:ggrc-core,代码行数:7,代码来源:test_workflow_export_csv.py

示例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")
开发者ID:zidarsk8,项目名称:ggrc-core,代码行数:7,代码来源:test_basic.py

示例15: setUpClass

# 需要导入模块: from integration.ggrc import TestCase [as 别名]
# 或者: from integration.ggrc.TestCase import clear_data [as 别名]
 def setUpClass(cls):
   TestCase.clear_data()
开发者ID:VinnieJohns,项目名称:ggrc-core,代码行数:4,代码来源:test_import_helpers.py


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