-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bad frames detection in stats plugin for python3 (#113)
Comparison of string vs binary string was preventing detection of private frames in stats plugin.
- Loading branch information
1 parent
6916b24
commit f1d7160
Showing
2 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from __future__ import unicode_literals | ||
import os | ||
import tempfile | ||
import unittest | ||
|
||
import eyed3.id3 | ||
import eyed3.main | ||
|
||
from . import RedirectStdStreams | ||
|
||
|
||
class TestId3FrameRules(unittest.TestCase): | ||
def test_bad_frames(self): | ||
try: | ||
fd, tempf = tempfile.mkstemp(suffix='.id3') | ||
os.close(fd) | ||
tagfile = eyed3.id3.TagFile(tempf) | ||
tagfile.initTag() | ||
tagfile.tag.title = 'mytitle' | ||
tagfile.tag.privates.set(b'mydata', b'onwer0') | ||
tagfile.tag.save() | ||
args = ['--plugin', 'stats', tempf] | ||
args, _, config = eyed3.main.parseCommandLine(args) | ||
|
||
with RedirectStdStreams() as out: | ||
eyed3.main.main(args, config) | ||
finally: | ||
os.remove(tempf) | ||
|
||
print(out.stdout.getvalue()) | ||
|
||
self.assertIn('PRIV frames are bad', out.stdout.getvalue()) |