def test_add_album(self): import os.path from lasco import api from lasco.models import Album from lasco.models import Gallery class FakeConfig: def get(self, section, option): assert section == 'app:lasco' assert option == 'lasco.pictures_base_path' return os.path.dirname(__file__) g = Gallery('g', u'title') self.session.add(g) assert not self.session.query(Album).all() dir = unicode(os.path.join(os.path.dirname(__file__), 'data')) api.add_album(self.session, FakeConfig(), 'g', 'album', u'album_title', dir) album = self.session.query(Album).one() self.assertEqual(album.title, 'album_title') self.assertEqual(len(album.pictures), 2)
def add_album(self, gallery_name, album_name, album_title, pictures_dir=u'data'): lascoapi.add_album(self.session, FAKE_CONFIG, gallery_name, album_name, album_title, pictures_dir)