當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。