aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-09-04 21:05:42 +0300
committerBonfaceKilz2023-09-05 14:57:51 +0300
commitea3030f90e23cfbbde4c5a19a18f81af4712535c (patch)
tree3dcb239b9a65e4b7a9cbdb7e2784776c115aa9dc /tests
parent22169b8a0c29f70f7189d62bcfe420ab29b45b5f (diff)
downloadgenenetwork3-ea3030f90e23cfbbde4c5a19a18f81af4712535c.tar.gz
Delete IPFS tests
* tests/unit/test_file_utils.py (test_cache_ipfs_file_cache_hit, test_cache_ipfs_file_cache_miss): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_file_utils.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/tests/unit/test_file_utils.py b/tests/unit/test_file_utils.py
index ed973b6..9e40d82 100644
--- a/tests/unit/test_file_utils.py
+++ b/tests/unit/test_file_utils.py
@@ -84,49 +84,3 @@ extracting the file"""
"status": 128,
"error": "gzip failed to unpack file"
})
-
- @unittest.skip("ipfs http client breaks in Python > 38")
- @pytest.mark.unit_test
- def test_cache_ipfs_file_cache_hit(self):
- """Test that the correct file location is returned if there's a cache hit"""
- # Create empty file
- test_dir = "/tmp/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc-test"
- if not os.path.exists(test_dir):
- os.mkdir(test_dir)
- with open(f"{test_dir}/genotype.txt", "a", encoding="utf8"):
- pass
- file_loc = cache_ipfs_file(
- ipfs_file=("/ipfs/"
- "QmQPeNsJPyVWPFDVHb"
- "77w8G42Fvo15z4bG2X8D2GhfbSXc-test/"
- "genotype.txt"),
- cache_dir="/tmp")
- # Clean up
- os.remove(f"{test_dir}/genotype.txt")
- os.rmdir(test_dir)
- self.assertEqual(file_loc, f"{test_dir}/genotype.txt")
-
- @unittest.skip("ipfs http client breaks in Python > 38")
- @pytest.mark.unit_test
- @mock.patch("gn3.fs_helpers.ipfshttpclient")
- def test_cache_ipfs_file_cache_miss(self,
- mock_ipfs):
- """Test that a file is cached if there's a cache miss"""
- mock_ipfs_client = mock.MagicMock()
- mock_ipfs.connect.return_value = mock_ipfs_client
-
- test_dir = "/tmp/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc-test"
- self.assertEqual(cache_ipfs_file(
- ipfs_file=("/ipfs/"
- "QmQPeNsJPyVWPFDVHb"
- "77w8G42Fvo15z4bG2X8D2GhfbSXc-test/"
- "genotype.txt"),
- cache_dir="/tmp"
- ), f"{test_dir}/genotype.txt")
- mock_ipfs_client.get.assert_called_once_with(
- ("/ipfs/"
- "QmQPeNsJPyVWPFDVHb"
- "77w8G42Fvo15z4bG2X8D2GhfbSXc-test/"
- "genotype.txt"),
- target=f"{test_dir}"
- )