CC-5990, CC-5991 - Python cleanup, removed need for /usr/lib/airtime
This commit is contained in:
parent
cd102b984b
commit
875a9dfd8b
115 changed files with 248 additions and 212 deletions
36
python_apps/media-monitor/mm2/tests/test_owners.py
Normal file
36
python_apps/media-monitor/mm2/tests/test_owners.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import unittest
|
||||
from media.monitor import owners
|
||||
|
||||
class TestMMP(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.f = "test.mp3"
|
||||
|
||||
def test_has_owner(self):
|
||||
owners.reset_owners()
|
||||
o = 12345
|
||||
self.assertTrue( owners.add_file_owner(self.f,o) )
|
||||
self.assertTrue( owners.has_owner(self.f) )
|
||||
|
||||
def test_add_file_owner(self):
|
||||
owners.reset_owners()
|
||||
self.assertFalse( owners.add_file_owner('testing', -1) )
|
||||
self.assertTrue( owners.add_file_owner(self.f, 123) )
|
||||
self.assertTrue( owners.add_file_owner(self.f, 123) )
|
||||
self.assertTrue( owners.add_file_owner(self.f, 456) )
|
||||
|
||||
def test_remove_file_owner(self):
|
||||
owners.reset_owners()
|
||||
self.assertTrue( owners.add_file_owner(self.f, 123) )
|
||||
self.assertTrue( owners.remove_file_owner(self.f) )
|
||||
self.assertFalse( owners.remove_file_owner(self.f) )
|
||||
|
||||
def test_get_owner(self):
|
||||
owners.reset_owners()
|
||||
self.assertTrue( owners.add_file_owner(self.f, 123) )
|
||||
self.assertEqual( owners.get_owner(self.f), 123, "file is owned" )
|
||||
self.assertEqual( owners.get_owner("random_stuff.txt"), -1,
|
||||
"file is not owned" )
|
||||
|
||||
if __name__ == '__main__': unittest.main()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue