Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@patchfs
def test_disable_write_to_file_cache(monkeypatch, fs):
# Beginning of setup.
Scenario().add_host("hostname").apply(monkeypatch)
source = SNMPDataSource("hostname", "ipaddress")
source.set_max_cachefile_age(999)
source.set_may_use_cache_file()
# Patch I/O: It is good enough to patch `store.save_file()`
# as pyfakefs takes care of the rest.
monkeypatch.setattr(store, "save_file",
lambda path, contents: fs.create_file(path, contents=contents))
file_cache = source._make_file_cache()
table: SNMPTable = []
raw_data: SNMPRawData = {SectionName("X"): table}
# End of setup.
@patchfs
def test_disable_read_to_file_cache(monkeypatch, fs):
# Beginning of setup.
Scenario().add_host("hostname").apply(monkeypatch)
source = SNMPDataSource("hostname", "ipaddress")
source.set_max_cachefile_age(999)
source.set_may_use_cache_file()
# Patch I/O: It is good enough to patch `store.save_file()`
# as pyfakefs takes care of the rest.
monkeypatch.setattr(store, "save_file",
lambda path, contents: fs.create_file(path, contents=contents))
file_cache = source._make_file_cache()
table: SNMPTable = []
raw_data: SNMPRawData = {SectionName("X"): table}
# End of setup.
@patchfs
def test_write_and_read_file_cache(monkeypatch, fs):
# Beginning of setup.
Scenario().add_host("hostname").apply(monkeypatch)
source = SNMPDataSource("hostname", "ipaddress")
source.set_max_cachefile_age(999)
source.set_may_use_cache_file()
# Patch I/O: It is good enough to patch `store.save_file()`
# as pyfakefs takes care of the rest.
monkeypatch.setattr(store, "save_file",
lambda path, contents: fs.create_file(path, contents=contents))
file_cache = source._make_file_cache()
table: SNMPTable = []
raw_data: SNMPRawData = {SectionName("X"): table}
@patchfs
def test_disable_read_to_file_cache(monkeypatch, fs):
# Beginning of setup.
Scenario().add_host("hostname").apply(monkeypatch)
source = SNMPDataSource("hostname", "ipaddress")
source.set_max_cachefile_age(999)
source.set_may_use_cache_file()
# Patch I/O: It is good enough to patch `store.save_file()`
# as pyfakefs takes care of the rest.
monkeypatch.setattr(store, "save_file",
lambda path, contents: fs.create_file(path, contents=contents))
file_cache = source._make_file_cache()
table: SNMPTable = []
raw_data: SNMPRawData = {SectionName("X"): table}
# End of setup.
@patchfs
def test_disable_write_to_file_cache(monkeypatch, fs):
# Beginning of setup.
Scenario().add_host("hostname").apply(monkeypatch)
source = SNMPDataSource("hostname", "ipaddress")
source.set_max_cachefile_age(999)
source.set_may_use_cache_file()
# Patch I/O: It is good enough to patch `store.save_file()`
# as pyfakefs takes care of the rest.
monkeypatch.setattr(store, "save_file",
lambda path, contents: fs.create_file(path, contents=contents))
file_cache = source._make_file_cache()
table: SNMPTable = []
raw_data: SNMPRawData = {SectionName("X"): table}
# End of setup.
@patchfs
def test_write_and_read_file_cache(monkeypatch, fs):
# Beginning of setup.
Scenario().add_host("hostname").apply(monkeypatch)
source = SNMPDataSource("hostname", "ipaddress")
source.set_max_cachefile_age(999)
source.set_may_use_cache_file()
# Patch I/O: It is good enough to patch `store.save_file()`
# as pyfakefs takes care of the rest.
monkeypatch.setattr(store, "save_file",
lambda path, contents: fs.create_file(path, contents=contents))
file_cache = source._make_file_cache()
table: SNMPTable = []
raw_data: SNMPRawData = {SectionName("X"): table}