Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 11
0
 def flags(self, factories):
     return [factories.Flag() for _ in xrange(3)]