示例#1
0
文件: tracks.py 项目: shish/KaraKara
def tracks_volume(request):
    tracks = [create_test_track(tags=['test']) for track_num in range(15)]
    [DBSession.add(track) for track in tracks]
    
    def finalizer():
        for track in tracks:
            DBSession.delete(track)
        commit()
    request.addfinalizer(finalizer)
    
    commit()
    cache.invalidate()
    return tracks
示例#2
0
def tracks_volume(request):
    """
    Create 15 random tracks to assert larger list
    """
    mock_tracks = tuple(create_test_track(tags=['test']) for track_num in range(15))

    def finalizer():
        for track in mock_tracks:
            DBSession.delete(track)
        commit()
    request.addfinalizer(finalizer)

    commit()
    cache.invalidate()
    return mock_tracks
示例#3
0
def tracks_volume(request):
    """
    Create 15 random tracks to assert larger list
    """
    mock_tracks = tuple(create_test_track(tags=['test']) for track_num in range(15))

    def finalizer():
        for track in mock_tracks:
            DBSession.delete(track)
        commit()
    request.addfinalizer(finalizer)

    commit()
    cache.invalidate()
    return mock_tracks
示例#4
0
def queue(request, DBSession, commit):
    QUEUE_ID = 'qtest'

    queue = Queue(id=QUEUE_ID)
    DBSession.add(queue)

    queue_setting = QueueSetting()
    queue_setting.queue_id = QUEUE_ID
    queue_setting.key = 'karakara.private.password'
    queue_setting.value = QUEUE_ID
    DBSession.add(queue_setting)

    commit()
    cache.invalidate()
    yield QUEUE_ID
    DBSession.delete(queue)
示例#5
0
def tracks(request, DBSession, commit, tags, attachments):
    """
    4 test tracks with various unicode characters, lyrics, attachments, tags
    """
    tracks_data = [
        {
            'id': "t1",
            'duration': 60,  # 1min
            'tags': [
                'title      :Test Track 1',
                #'description:Test track for the KaraKara system with キ',
                'opening', 'male', 'jp', 'anime', 'jpop', 'series X',
            ],
            'attachments': ['image1', 'preview1', 'processed'],
            'lyrics': 'ここにいくつかのテキストです。',
            'source_filename': 'track1source',
        },
        {
            'id': "t2",
            'duration': 120,  # 2min
            'tags': [
                'title      :Test Track 2',
                #'description:Test track for the KaraKara system with キ'
                'ending', 'female', 'en', 'anime', 'series X',
            ],
            'attachments': ['image2', 'preview2'],
            'lyrics': 'Line1\nLine2\nLine3\nLine4\näöü"',
            'source_filename': 'track2source',
        },
        {
            'id': "t3",
            'duration': 240,  # 4min
            'tags':[
                'title      :Test Track 3 キ',
                #'description:Test track for the KaraKara system with キ',
                'ending', 'female', 'en', 'jpop', 'series Y',
            ],
            'attachments': ['image3', 'preview3'],
            'source_filename': 'track3source',
        },
        {
            'id': "xxx",
            'duration': 300,  # 5min
            'tags': [
                'title      :Wildcard',
                'lang:fr',
            ],
            'attachments': [],
            'source_filename': 'wildcardsource',
        },
    ]

    mock_tracks = tuple(create_test_track(**track_data) for track_data in tracks_data)  # Keep tabs on all tracks generated

    def finalizer():
        pass
        #for track in tracks:
        #    DBSession.delete(track)
        #commit()
    request.addfinalizer(finalizer)

    commit()
    cache.invalidate()
    return mock_tracks
示例#6
0
def tracks(request, DBSession, commit, tags, attachments):
    """
    4 test tracks with various unicode characters, lyrics, attachments, tags
    """
    tracks_data = [
        {
            'id': "t1",
            'duration': 60,  # 1min
            'tags': [
                'title      :Test Track 1',
                #'description:Test track for the KaraKara system with キ',
                'opening', 'male', 'jp', 'anime', 'jpop', 'series X',
            ],
            'attachments': ['image1', 'preview1', 'processed'],
            'lyrics': 'ここにいくつかのテキストです。',
            'source_filename': 'track1source',
        },
        {
            'id': "t2",
            'duration': 120,  # 2min
            'tags': [
                'title      :Test Track 2',
                #'description:Test track for the KaraKara system with キ'
                'ending', 'female', 'en', 'anime', 'series X',
            ],
            'attachments': ['image2', 'preview2'],
            'lyrics': 'Line1\nLine2\nLine3\nLine4\näöü"',
            'source_filename': 'track2source',
        },
        {
            'id': "t3",
            'duration': 240,  # 4min
            'tags':[
                'title      :Test Track 3 キ',
                #'description:Test track for the KaraKara system with キ',
                'ending', 'female', 'en', 'jpop', 'series Y',
            ],
            'attachments': ['image3', 'preview3'],
            'source_filename': 'track3source',
        },
        {
            'id': "xxx",
            'duration': 300,  # 5min
            'tags': [
                'title      :Wildcard',
                'lang:fr',
            ],
            'attachments': [],
            'source_filename': 'wildcardsource',
        },
    ]

    mock_tracks = tuple(create_test_track(**track_data) for track_data in tracks_data)  # Keep tabs on all tracks generated

    def finalizer():
        pass
        #for track in tracks:
        #    DBSession.delete(track)
        #commit()
    request.addfinalizer(finalizer)

    commit()
    cache.invalidate()
    return mock_tracks
示例#7
0
文件: tracks.py 项目: shish/KaraKara
def tracks(request, DBSession, commit, tags, attachments, lyrics):
    tracks_data = [
        {
            'id'      :"t1",
            'duration': 60, # 1min
            'tags':[
                'title      :Test Track 1',
                #'description:Test track for the KaraKara system with キ',
                'opening','male','jp','anime','jpop', 'series X',
            ],
            'attachments': ['image1','preview1'],
            'lyrics': lyrics[0],
            'source_filename': 'track1',
        },
        {
            'id'      :"t2",
            'duration': 120, # 2min
            'tags':[
                'title      :Test Track 2',
                #'description:Test track for the KaraKara system with キ'
                'ending','female','en','anime', 'series X',
            ],
            'attachments': ['image2','preview2'],
            'lyrics':lyrics[1],
            'source_filename': 'track2',
        },
        {
            'id'      :"t3",
            'duration': 240, # 4min
            'tags':[
                'title      :Test Track 3 キ',
                #'description:Test track for the KaraKara system with キ',
                'ending','female','en','jpop', 'series Y',
            ],
            'attachments': ['image3','preview3'],
            'source_filename': 'track3',
        },
        {
            'id'      :"xxx",
            'duration': 300, # 5min
            'tags':[
                'title      :Wildcard',
                'fr',
            ],
            'attachments': [],
            'source_filename': 'wildcard',
        },
    ]
    
    tracks = [] # Keep tabs on all tracks generated 
    for track_data in tracks_data:
        track = create_test_track(**track_data)
        DBSession.add(track)
        tracks.append(track)

    def finalizer():
        pass
        #for track in tracks:
        #    DBSession.delete(track)
        #commit()
    request.addfinalizer(finalizer)
    
    commit()
    cache.invalidate()
    return tracks