Пример #1
0
    def testLarge(self, taskqueue, fastndb):
        data = 'A' * 100000
        deferred.defer(A, data)

        payload = deferred._DeferredTaskEntity.query().get()
        assert payload.large

        consume(taskqueue)
        assert [data] == messages
        assert deferred._DeferredTaskEntity.query().fetch() == []
Пример #2
0
    def testHuge(self, taskqueue, fastndb, blobstore):
        data = 'A' * 1000000
        deferred.defer(A, data)

        payload = deferred._DeferredTaskEntity.query().get()
        assert payload.huge

        consume(taskqueue)
        assert [data] == messages
        assert deferred._DeferredTaskEntity.query().fetch() == []
        assert blobstore.BlobInfo.all().fetch(limit=None) == []
Пример #3
0
    def testAddsArgsToTheUrl(self, taskqueue):
        task = deferred.defer(A, 'A', _url_args='foo')
        assert task.url == deferred._DEFAULT_URL + "/foo"

        task = deferred.defer(A, 'A', _url_args=('foo'))
        assert task.url == deferred._DEFAULT_URL + "/foo"

        task = deferred.defer(A, 'A', _url_args=('foo',))
        assert task.url == deferred._DEFAULT_URL + "/foo"

        task = deferred.defer(A, 'A', _url_args=('foo','bar'))
        assert task.url == deferred._DEFAULT_URL + "/foo/bar"
Пример #4
0
 def testRemovesArgsBeforeCallingTheDeferred(self, taskqueue):
     task = deferred.defer(A, 'A', _url_args=('foo','bar'))
     consume(taskqueue)
     assert ['A'] == messages
Пример #5
0
    def testSmall(self, taskqueue, fastndb):
        deferred.defer(A, 'A')
        assert deferred._DeferredTaskEntity.query().fetch() == []

        consume(taskqueue)
        assert ['A'] == messages