예제 #1
0
def karton_classifier(request):
    def _magic_from_content(_, content, mime):
        return magic_from_content(content, mime)

    classifier = Classifier(magic=magic_from_content,
                            config=ConfigMock(),
                            backend=KartonBackendMock())
    request.cls.magic_from_content = _magic_from_content
    request.cls.karton = classifier
예제 #2
0
def mock_classifier(magic: str, mime: str) -> Classifier:
    m = MagicMock()
    m.side_effect = [
        magic,
        mime,
    ]
    return Classifier(magic=m,
                      config=ConfigMock(),
                      backend=KartonBackendMock())
 def setUp(self):
     self.config = ConfigMock()
     self.backend = KartonBackendMock()