MCPcopy Index your code
hub / github.com/saltstack/salt / test_get_file_gzipped

Method test_get_file_gzipped

tests/integration/modules/test_cp.py:86–100  ·  view source on GitHub ↗

cp.get_file

(self, tgt)

Source from the content-addressed store, hash-verified

84 @with_tempfile()
85 @pytest.mark.slow_test
86 def test_get_file_gzipped(self, tgt):
87 """
88 cp.get_file
89 """
90 src = os.path.join(RUNTIME_VARS.FILES, "file", "base", "file.big")
91 with salt.utils.files.fopen(src, "rb") as fp_:
92 hash_str = hashlib.sha256(fp_.read()).hexdigest()
93
94 self.run_function("cp.get_file", ["salt://file.big", tgt], gzip=5)
95 with salt.utils.files.fopen(tgt, "rb") as scene:
96 data = scene.read()
97 self.assertEqual(hash_str, hashlib.sha256(data).hexdigest())
98 data = salt.utils.stringutils.to_unicode(data)
99 self.assertIn("KNIGHT: They're nervous, sire.", data)
100 self.assertNotIn("bacon", data)
101
102 @pytest.mark.slow_test
103 def test_get_file_makedirs(self):

Callers

nothing calls this directly

Calls 2

run_functionMethod · 0.95
readMethod · 0.45

Tested by

no test coverage detected