From a2989cfbd342e7c0e3e0d146268cfce64a09c262 Mon Sep 17 00:00:00 2001 From: Dan Puttick Date: Fri, 14 Jul 2017 16:40:26 -0400 Subject: [PATCH] Add tests for mimetypes --- tests/test_kittengroomer.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_kittengroomer.py b/tests/test_kittengroomer.py index c37ec49..aad3c88 100644 --- a/tests/test_kittengroomer.py +++ b/tests/test_kittengroomer.py @@ -122,11 +122,18 @@ class TestFileBase: def test_maintype_and_subtype_attributes(self): """If a file has a full mimetype, maintype and subtype should == 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): """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