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
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
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)
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
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