Add tests for mimetypes

pull/16/head
Dan Puttick 2017-07-14 16:40:26 -04:00
parent 930b059ae1
commit a2989cfbd3
1 changed files with 9 additions and 2 deletions

View File

@ -122,11 +122,18 @@ class TestFileBase:
def test_maintype_and_subtype_attributes(self): def test_maintype_and_subtype_attributes(self):
"""If a file has a full mimetype, maintype and subtype should == """If a file has a full mimetype, maintype and subtype should ==
the appropriate values.""" the appropriate values."""
pass with mock.patch('kittengroomer.helpers.magic.from_file',
return_value='text/plain'):
file = FileBase('', '')
assert file.maintype == 'text'
assert file.subtype == 'plain'
def test_has_mimetype_no_full_type(self): def test_has_mimetype_no_full_type(self):
"""If a file doesn't have a full mimetype has_mimetype should == False.""" """If a file doesn't have a full mimetype has_mimetype should == False."""
pass with mock.patch('kittengroomer.helpers.magic.from_file',
return_value='data'):
file = FileBase('', '')
assert file.has_mimetype == False
# File properties # File properties