コード例 #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
ファイル: rename_user_test.py プロジェクト: chinmaygghag/h
    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
ファイル: bucketing_test.py プロジェクト: chinmaygghag/h
    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
ファイル: bucketing_test.py プロジェクト: chinmaygghag/h
    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
ファイル: bucketing_test.py プロジェクト: chinmaygghag/h
    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
ファイル: normalize_uris.py プロジェクト: chinmaygghag/h
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)]