1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-14 14:12:17 +00:00
supysonic/tests/issue129.py

52 lines
1.4 KiB
Python
Raw Normal View History

# This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2018 Alban 'spl0k' Féron
#
# Distributed under terms of the GNU AGPLv3 license.
import os.path
import unittest
from pony.orm import db_session
from supysonic.db import User, Track, StarredTrack, RatingTrack
from supysonic.managers.folder import FolderManager
from supysonic.scanner import Scanner
from .testbase import TestBase
2019-06-29 15:25:44 +00:00
class Issue129TestCase(TestBase):
def setUp(self):
2020-11-22 15:12:14 +00:00
super().setUp()
with db_session:
FolderManager.add("folder", os.path.abspath("tests/assets/folder"))
scanner = Scanner()
2019-06-29 15:25:44 +00:00
scanner.queue_folder("folder")
2019-05-11 15:13:58 +00:00
scanner.run()
self.trackid = Track.select().first().id
2019-06-29 15:25:44 +00:00
self.userid = User.get(name="alice").id
def test_last_play(self):
with db_session:
User[self.userid].last_play = Track[self.trackid]
with db_session:
2019-06-29 15:25:44 +00:00
FolderManager.delete_by_name("folder")
def test_starred(self):
with db_session:
2019-06-29 15:25:44 +00:00
StarredTrack(user=self.userid, starred=self.trackid)
FolderManager.delete_by_name("folder")
def test_rating(self):
with db_session:
2019-06-29 15:25:44 +00:00
RatingTrack(user=self.userid, rated=self.trackid, rating=5)
FolderManager.delete_by_name("folder")
2019-06-29 15:25:44 +00:00
if __name__ == "__main__":
unittest.main()