def test_get_mime_type(): """Test MIME type getting when Content-Type is given.""" url = 'http://www.example.com/files/einstein_1905.pdf' responses.add(responses.HEAD, url, status=200, content_type='application/pdf') assert get_mime_type(url) == 'application/pdf' assert get_mime_type(None) == '' assert get_mime_type('') == ''
def test_get_mime_type_no_content(): """Test MIME type getting when no Content-Type given.""" url = 'http://www.example.com/files/einstein_1905.pdf' responses.add(responses.HEAD, url, status=200, content_type=None) with pytest.raises(Exception): assert get_mime_type(url)
def test_get_mime_type_no_content(): """Test MIME type getting when no Content-Type given.""" url = 'http://www.example.com/files/einstein_1905.pdf' responses.add(responses.HEAD, url, status=200, content_type=None) with pytest.raises(Exception): assert get_mime_type(url)