Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9312182
D895.id2830.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D895.id2830.diff
View Options
diff --git a/swh/indexer/tests/test_mimetype.py b/swh/indexer/tests/test_mimetype.py
--- a/swh/indexer/tests/test_mimetype.py
+++ b/swh/indexer/tests/test_mimetype.py
@@ -5,8 +5,6 @@
import unittest
-from unittest.mock import patch
-
from swh.indexer.mimetype import (
MimetypeIndexer, MimetypeRangeIndexer, compute_mimetype_encoding
)
@@ -18,21 +16,12 @@
)
-class FakeMagicResult:
- def __init__(self, mimetype, encoding):
- self.mime_type = mimetype
- self.encoding = encoding
-
-
class BasicTest(unittest.TestCase):
- @patch('swh.indexer.mimetype.magic')
- def test_compute_mimetype_encoding(self, mock_magic):
+ def test_compute_mimetype_encoding(self):
"""Compute mimetype encoding should return results"""
for _input, _mimetype, _encoding in [
- (b'some-content', 'text/plain', 'utf-8'),
- (b'raw-content', 'application/json', 'ascii')]:
- mock_magic.detect_from_content.return_value = FakeMagicResult(
- _mimetype, _encoding)
+ ('du français'.encode(), 'text/plain', 'utf-8'),
+ (b'def __init__(self):', 'text/x-python', 'us-ascii')]:
actual_result = compute_mimetype_encoding(_input)
self.assertEqual(actual_result, {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 2, 10:45 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3215423
Attached To
D895: Unmock libmagic.
Event Timeline
Log In to Comment