mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
22 lines
698 B
Python
22 lines
698 B
Python
|
|
from unittest import mock
|
||
|
|
|
||
|
|
from modules.map import lib
|
||
|
|
|
||
|
|
|
||
|
|
def test_get_map_paths(test_directory):
|
||
|
|
pbf_dir = test_directory / 'map/pbf'
|
||
|
|
pbf_dir.mkdir(parents=True)
|
||
|
|
|
||
|
|
pbf = pbf_dir / 'map.osm.pbf'
|
||
|
|
pbf.touch()
|
||
|
|
dump = pbf_dir / 'map.dump'
|
||
|
|
dump.touch()
|
||
|
|
|
||
|
|
with mock.patch('modules.map.lib.subprocess.check_output') as mock_check_output:
|
||
|
|
mock_check_output.return_value = b'OpenStreetMap Protocolbuffer Binary Format'
|
||
|
|
assert lib.get_map_paths() == [pbf, ]
|
||
|
|
|
||
|
|
with mock.patch('modules.map.lib.subprocess.check_output') as mock_check_output:
|
||
|
|
mock_check_output.return_value = b'PostgreSQL custom database dump'
|
||
|
|
assert lib.get_map_paths() == [dump, ]
|