예제 #1
0
파일: disk.py 프로젝트: andrewcooke/ypod
 def test_sync_mp3(self):
     config = Config(db='sqlite://')
     Session = create_session(config)
     session = Session()
     sync_mp3(config, session)
     assert Track.count(session) == 141, Track.count(session)
     assert Artist.count(session) == 27, Artist.count(session)
     assert Album.count(session) == 12, Album.count(session)
예제 #2
0
 def test_track(self):
     config = Config(db='sqlite://')
     Session = create_session(config)
     session = Session()
     sync_mp3(config, session)
     track = session.query(Track).order_by(Track.id).first()
     assert track
     with GPod(config) as db:
         db.load_track(track)
예제 #3
0
파일: changes.py 프로젝트: andrewcooke/ypod
 def test_load(self):
     config = Config(db='sqlite://')
     Session = create_session(config)
     session = Session()
     sync_mp3(config, session)
     capacity, contains = 100, 0
     capacity, contains = self.load_once(session, capacity, contains)
     assert contains > capacity
     capacity, contains = self.load_once(session, capacity, contains)
     assert contains > capacity
예제 #4
0
파일: shuffle.py 프로젝트: andrewcooke/ypod
 def test_shuffle(self):
     config = Config(mount=expanduser('~/project/ypod/ln-music'),
                     mp3=expanduser('~/project/ypod/music'),
                     db='sqlite://', capacity=1e6)
     Session = create_session(config)
     session = Session()
     sync_mp3(config, session)
     target = Links(config)
     shuffle_to_capacity(RandomUpdateAlbum(session), target)
     print 'size: %d' % target._size
     shuffle_to_capacity(RandomUpdateAlbum(session), target)
     print 'size: %d' % target._size
예제 #5
0
파일: schema.py 프로젝트: andrewcooke/ypod
 def test_next_disk_generation(self):
     config = Config(db="sqlite://")
     Session = create_session(config)
     session = Session()
     artist = Artist(name="bob")
     session.add(artist)
     album = Album(name="bob sings")
     session.add(album)
     track = Track(artist=artist, album=album, name="a sad song", disk_generation=3, path="/music/bob/songs")
     session.add(track)
     session.commit()
     assert Track.current_disk_generation(session) == 3
     track = session.query(Track).filter(Track.name == "a sad song").one()
     assert track.name == "a sad song"
     assert track.artist.name == "bob"
     artist = session.query(Artist).filter(Artist.name == "bob").one()
     assert artist.name == "bob"
     assert track.artist == artist
예제 #6
0
파일: schema.py 프로젝트: andrewcooke/ypod
 def test_schema(self):
     config = Config(db="sqlite://")
     Session = create_session(config)
     session = Session()
     assert Track.current_disk_generation(session) == 0, Track.current_disk_generation(session)