Exemplo n.º 1
0
    def setUp(self):
        super().setUp()

        with db_session:
            root = Folder(name="Root", root=True, path="tests")
            folder = Folder(name="Folder", path="tests/assets", parent=root)
            artist = Artist(name="Artist")
            album = Album(name="Album", artist=artist)

            # Populate folder ids
            root = Folder.get(name="Root")
            folder = Folder.get(name="Folder")

            track = Track(
                title="Track",
                album=album,
                artist=artist,
                disc=1,
                number=1,
                path="tests/assets/empty",
                folder=folder,
                root_folder=root,
                duration=2,
                bitrate=320,
                last_modification=0,
            )

            self.folderid = folder.id
            self.artistid = artist.id
            self.albumid = album.id
            self.trackid = track.id
            self.user = User.get(name="alice")
Exemplo n.º 2
0
    def setUp(self):
        super(AnnotationTestCase, self).setUp()

        with db_session:
            root = Folder(name='Root', root=True, path='tests')
            folder = Folder(name='Folder', path='tests/assets', parent=root)
            artist = Artist(name='Artist')
            album = Album(name='Album', artist=artist)

            track = Track(title='Track',
                          album=album,
                          artist=artist,
                          disc=1,
                          number=1,
                          path='tests/assets/empty',
                          folder=folder,
                          root_folder=root,
                          duration=2,
                          bitrate=320,
                          content_type='audio/mpeg',
                          last_modification=0)

            self.folderid = folder.id
            self.artistid = artist.id
            self.albumid = album.id
            self.trackid = track.id
            self.user = User.get(name='alice')
Exemplo n.º 3
0
    def setUp(self):
        super(AnnotationTestCase, self).setUp()

        with db_session:
            root = Folder(name = 'Root', root = True, path = 'tests')
            folder = Folder(name = 'Folder', path = 'tests/assets', parent = root)
            artist = Artist(name = 'Artist')
            album = Album(name = 'Album', artist = artist)

            track = Track(
                title = 'Track',
                album = album,
                artist = artist,
                disc = 1,
                number = 1,
                path = 'tests/assets/empty',
                folder = folder,
                root_folder = root,
                duration = 2,
                bitrate = 320,
                last_modification = 0
            )

            self.folderid = folder.id
            self.artistid = artist.id
            self.albumid = album.id
            self.trackid = track.id
            self.user = User.get(name = 'alice')
Exemplo n.º 4
0
    def setUp(self):
        super(PlaylistTestCase, self).setUp()

        with db_session:
            folder = Folder(name="Root", path="tests/assets", root=True)
            artist = Artist(name="Artist!")
            album = Album(name="Album!", artist=artist)

            track = Track(
                path="tests/assets/23bytes",
                title="23bytes",
                artist=artist,
                album=album,
                folder=folder,
                root_folder=folder,
                duration=2,
                disc=1,
                number=1,
                bitrate=320,
                last_modification=0,
            )

            playlist = Playlist(name="Playlist!", user=User.get(name="alice"))
            for _ in range(4):
                playlist.add(track)

        self.playlistid = playlist.id
Exemplo n.º 5
0
 def test_root_with_valid_session(self):
     # Root with valid session
     with db_session:
         with self.client.session_transaction() as sess:
             sess["userid"] = User.get(name="alice").id
     rv = self.client.get("/", follow_redirects=True)
     self.assertIn("alice", rv.data)
     self.assertIn("Log out", rv.data)
     self.assertIn("There's nothing much to see here.", rv.data)
Exemplo n.º 6
0
    def setUp(self):
        super().setUp()

        with db_session:
            FolderManager.add("folder", os.path.abspath("tests/assets/folder"))
            scanner = Scanner()
            scanner.queue_folder("folder")
            scanner.run()

            self.trackid = Track.select().first().id
            self.userid = User.get(name="alice").id
Exemplo n.º 7
0
 def test_user_unsetjukebox(self):
     self.__cli.onecmd("user add -p Alic3 alice")
     self.__cli.onecmd("user setroles -J alice")
     self.__cli.onecmd("user setroles -j alice")
     with db_session:
         self.assertFalse(User.get(name="alice").jukebox)
Exemplo n.º 8
0
 def test_user_unsetadmin(self):
     self.__cli.onecmd("user add -p Alic3 alice")
     self.__cli.onecmd("user setroles -A alice")
     self.__cli.onecmd("user setroles -a alice")
     with db_session:
         self.assertFalse(User.get(name="alice").admin)
Exemplo n.º 9
0
 def test_user_setjukebox(self):
     self.__invoke("user add -p Alic3 alice")
     self.__invoke("user setroles -J alice")
     with db_session:
         self.assertTrue(User.get(name="alice").jukebox)
Exemplo n.º 10
0
 def test_user_setadmin(self):
     self.__invoke("user add -p Alic3 alice")
     self.__invoke("user setroles -A alice")
     self.__invoke("user setroles -A bob", True)
     with db_session:
         self.assertTrue(User.get(name="alice").admin)