aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-02 16:47:10 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-02 17:02:50 -0700
commit4bb25cec68f1b2613a906e416d4ee3abf9050f6d (patch)
tree59fdf081fdf841ef08f9188880399e5265f26e5c /python/tests
parent675ecb96fe0e51f169c2d01683f02205ef327825 (diff)
downloadfatcat-4bb25cec68f1b2613a906e416d4ee3abf9050f6d.tar.gz
fatcat-4bb25cec68f1b2613a906e416d4ee3abf9050f6d.zip
hacks to work around new pylint false positives
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/transform_elasticsearch.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/python/tests/transform_elasticsearch.py b/python/tests/transform_elasticsearch.py
index b9011892..c11c5972 100644
--- a/python/tests/transform_elasticsearch.py
+++ b/python/tests/transform_elasticsearch.py
@@ -204,15 +204,21 @@ def test_elasticsearch_container_transform(journal_metadata_importer):
def test_elasticsearch_file_transform():
- f = entity_from_json(open('./tests/files/file_bcah4zp5tvdhjl5bqci2c2lgfa.json', 'r').read(), FileEntity)
-
- f.state = 'active'
- es = file_to_elasticsearch(f)
- assert es['sha1'] == f.sha1
- assert es['sha256'] == f.sha256
- assert es['md5'] == f.md5
- assert es['size_bytes'] == f.size
- assert es['mimetype'] == f.mimetype
+
+ with open('./tests/files/file_bcah4zp5tvdhjl5bqci2c2lgfa.json', 'r') as f:
+ json_str = f.read()
+
+ fe = entity_from_json(json_str, FileEntity)
+
+ fe.state = 'active'
+ es = file_to_elasticsearch(fe)
+
+ # pylint infers type of 'fe' incorrectly for some reason (as str/bytes)
+ assert es['sha1'] == fe.sha1 # pylint: disable=no-member
+ assert es['sha256'] == fe.sha256 # pylint: disable=no-member
+ assert es['md5'] == fe.md5 # pylint: disable=no-member
+ assert es['size_bytes'] == fe.size # pylint: disable=no-member
+ assert es['mimetype'] == fe.mimetype # pylint: disable=no-member
assert es['in_ia'] == True
assert 'web' in es['rels']