示例#1
0
    def test_rename_deletes_auth_tickets(self, service, user, db_session, factories):
        ids = [factories.AuthTicket(user=user).id for _ in xrange(3)]

        service.rename(user, 'panda')

        count = db_session.query(models.AuthTicket).filter(models.AuthTicket.id.in_(ids)).count()
        assert count == 0
示例#2
0
    def test_rename_deletes_auth_tickets(self, service, user, db_session, factories):
        ids = [factories.AuthTicket(user=user).id for _ in xrange(3)]

        service.rename(user, 'panda')

        count = db_session.query(models.AuthTicket).filter(models.AuthTicket.id.in_(ids)).count()
        assert count == 0
示例#3
0
    def test_annotations_count_returns_count_of_annotations(self, db_session, document):
        bucket = bucketing.DocumentBucket(document)

        for _ in xrange(7):
            annotation = factories.Annotation()
            bucket.append(annotation)

        assert bucket.annotations_count == 7
示例#4
0
    def test_annotations_count_returns_count_of_annotations(self, db_session, document):
        bucket = bucketing.DocumentBucket(document)

        for _ in xrange(7):
            annotation = factories.Annotation()
            bucket.append(annotation)

        assert bucket.annotations_count == 7
示例#5
0
    def test_append_appends_the_annotation(self, document):
        bucket = bucketing.DocumentBucket(document)

        annotations = []
        for _ in xrange(7):
            annotation = factories.Annotation()
            annotations.append(annotation)
            bucket.append(annotation)

        assert bucket.annotations == annotations
示例#6
0
    def test_eq(self, document):
        bucket_1 = bucketing.DocumentBucket(document)
        bucket_2 = bucketing.DocumentBucket(document)

        for _ in xrange(5):
            annotation = factories.Annotation()
            bucket_1.append(annotation)
            bucket_2.append(annotation)

        assert bucket_1 == bucket_2
示例#7
0
    def test_append_appends_the_annotation(self, document):
        bucket = bucketing.DocumentBucket(document)

        annotations = []
        for _ in xrange(7):
            annotation = factories.Annotation()
            annotations.append(annotation)
            bucket.append(annotation)

        assert bucket.annotations == annotations
示例#8
0
    def test_eq(self, document):
        bucket_1 = bucketing.DocumentBucket(document)
        bucket_2 = bucketing.DocumentBucket(document)

        for _ in xrange(5):
            annotation = factories.Annotation()
            bucket_1.append(annotation)
            bucket_2.append(annotation)

        assert bucket_1 == bucket_2
示例#9
0
def _fetch_windows(session, column, chunksize=100):
    updated = (session.query(column).execution_options(
        stream_results=True).order_by(column.desc()).all())

    count = len(updated)
    windows = [
        Window(start=updated[min(x + chunksize, count) - 1].updated,
               end=updated[x].updated) for x in xrange(0, count, chunksize)
    ]

    return windows
示例#10
0
def _fetch_windows(session, column, chunksize=100):
    updated = session.query(column). \
        execution_options(stream_results=True). \
        order_by(column.desc()).all()

    count = len(updated)
    windows = [Window(start=updated[min(x+chunksize, count)-1].updated,
                      end=updated[x].updated)
               for x in xrange(0, count, chunksize)]

    return windows
示例#11
0
文件: flag_test.py 项目: st-fresh/h
 def flags(self, factories):
     return [factories.Flag() for _ in xrange(3)]