Skip to content

Commit

Permalink
added a basic test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Bonnett committed Jul 15, 2011
1 parent f3b197f commit 1b9a124
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion armstrong/apps/audio/backends/id3reader/id3proxy.py
Expand Up @@ -3,7 +3,7 @@



class Id3readerBackend():
class Id3readerBackend(object):
"""
wrapper for the "don't make me regret this licensed"
id3 reader written by Ned Batchelder
Expand Down
28 changes: 28 additions & 0 deletions armstrong/apps/audio/backends/id3reader/tests.py
@@ -1,3 +1,31 @@
import unittest
from .id3proxy import Id3readerBackend

class Id3ReaderTestCase(unittest.TestCase):
audio_metadata = {'album': u'from the internet',
'title': u'im chargin my laser',
'artist': u'armstrong',
'genre': u'Satire',
'date': u'2011',
'tracknumber': u'1'}
backend=Id3readerBackend()
def setUp(self):
self.file = open('test_audio_files/test.mp3','rb+')

def test_metadata(self):
"""
confirm that the extracted metadata matches the expected values
"""
metadata = self.backend.metadata(file=self.file)
for fieldname, value in self.audio_metadata.items():
self.assertEqual( value, metadata[fieldname])

def test_filetype(self):
"""
confirm expected filetype
"""
filetype = self.backend.filetype(file=self.file)

def runTest(self):
self.test_metadata()
self.test_filetype()
7 changes: 4 additions & 3 deletions fabfile.py
@@ -1,7 +1,8 @@
import unittest
from fabric.decorators import task
from fabric.decorators import *
from armstrong.apps.audio.backends.id3reader.tests import Id3ReaderTestCase

@task
def test():
from armstrong.apps.audio.backends.id3reader.tests import *
unittest.main()
suite = unittest.TestLoader().loadTestsFromTestCase(Id3ReaderTestCase)
unittest.TextTestRunner(verbosity=2).run(suite)
Binary file added test_audio_files/test.mp3
Binary file not shown.

0 comments on commit 1b9a124

Please sign in to comment.