Last change
on this file since 1 was
1,
checked in by myroslav, 18 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
1.4 KB
|
Rev | Line | |
---|
[1] | 1 | def test_suite(): |
---|
| 2 | from unittest import TestSuite |
---|
| 3 | |
---|
| 4 | suite = TestSuite() |
---|
| 5 | |
---|
| 6 | if has_plone(): |
---|
| 7 | import os |
---|
| 8 | from App import Common |
---|
| 9 | from Testing.ZopeTestCase.zopedoctest import ZopeDocFileSuite |
---|
| 10 | from p4a.audiopatch.tests.ploneintegration import testclass_builder |
---|
| 11 | from Products.PloneTestCase import layer |
---|
| 12 | |
---|
| 13 | pkg_home = Common.package_home({'__name__': 'p4a.audiopatch.tests'}) |
---|
| 14 | samplesdir = os.path.join(pkg_home, 'samples') |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | from p4a.audio.mp3.thirdparty import eyeD3 |
---|
| 18 | |
---|
| 19 | samplefile = os.path.join(samplesdir, 'test-cyrrilic.mp3') |
---|
| 20 | mimetype = 'audio/mpeg' |
---|
| 21 | encoding = 'WINDOWS-1251' |
---|
| 22 | |
---|
| 23 | t = eyeD3.Tag() |
---|
| 24 | t.link(samplefile) |
---|
| 25 | |
---|
| 26 | eyeD3_encoding = 'latin_1' |
---|
| 27 | |
---|
| 28 | fields = dict( |
---|
| 29 | title=t.getTitle().encode(eyeD3_encoding).decode(encoding), |
---|
| 30 | artist=t.getArtist().encode(eyeD3_encoding).decode(encoding), |
---|
| 31 | album=t.getAlbum().encode(eyeD3_encoding).decode(encoding), |
---|
| 32 | ) |
---|
| 33 | |
---|
| 34 | suite.addTest(ZopeDocFileSuite('plone-audio-impl.txt', package='p4a.audiopatch', |
---|
| 35 | test_class=testclass_builder(samplefile=samplefile, |
---|
| 36 | required_mimetype=mimetype, |
---|
| 37 | file_content_type='File', |
---|
| 38 | fields=fields, |
---|
| 39 | tag_encoding=encoding, |
---|
| 40 | eyeD3_encoding=eyeD3_encoding) |
---|
| 41 | ) |
---|
| 42 | ) |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | suite.layer = layer.ZCMLLayer |
---|
| 46 | |
---|
| 47 | return suite |
---|
| 48 | |
---|
| 49 | def has_plone(): |
---|
| 50 | try: |
---|
| 51 | import Products.CMFPlone |
---|
| 52 | except ImportError, e: |
---|
| 53 | return False |
---|
| 54 | return True |
---|
Note: See
TracBrowser
for help on using the repository browser.