コード例 #1
0
ファイル: testutil.py プロジェクト: muhammedsansal/bridgy
  def setUp(self):
    super(HandlerTest, self).setUp()
    self.handler = util.Handler(self.request, self.response)
    FakeGrSource.clear()
    util.now_fn = lambda: NOW

    # we use global queries in tests to verify entities in the datastore, so
    # make the datastore stub always return consistent data. not ideal, since it
    # doesn't simulate eventual consistency, but oh well.
    # https://cloud.google.com/appengine/docs/python/tools/localunittesting#Python_Writing_High_Replication_Datastore_tests
    policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1)
    self.testbed.init_datastore_v3_stub(consistency_policy=policy)

    # add FakeSource everywhere necessary
    util.BLACKLIST.add('fa.ke')
コード例 #2
0
    def setUp(self):
        super(HandlerTest, self).setUp()
        self.handler = util.Handler(self.request, self.response)
        FakeGrSource.clear()
        util.now_fn = lambda: NOW

        # add FakeSource everywhere necessary
        util.BLACKLIST.add('fa.ke')

        util.webmention_endpoint_cache.clear()
        self.stubbed_create_task = False
        tasks_client.create_task = lambda *args, **kwargs: Task(name='foo')

        # clear datastore
        orig_requests_post('http://%s/reset' % ndb_client.host)
        self.ndb_context = ndb_client.context()
        self.ndb_context.__enter__()