From 40b43b66ab788c60fe3753f9c44207e360ff8fad Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Mon, 6 Apr 2020 21:19:17 -0700 Subject: [PATCH] Fix common.get_tor_paths test --- .circleci/config.yml | 2 +- BUILD.md | 2 +- tests/test_cli_common.py | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dd84e371..67d8ab0e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ jobs: name: Install dependencies command: | sudo apt-get update - sudo apt-get install -y python3-pip xvfb + sudo apt-get install -y python3-pip xvfb tor obfs4proxy sudo pip3 install poetry flake8 poetry install diff --git a/BUILD.md b/BUILD.md index 1d324b38..2efd251e 100644 --- a/BUILD.md +++ b/BUILD.md @@ -32,7 +32,7 @@ cd onionshare The recommended way to develop OnionShare is to use the latest versions of all dependencies. -First, install `tor` from either the [official Debian repository](https://support.torproject.org/apt/tor-deb-repo/), or from your package manager. +First, install `tor` and `obfs4proxy` from either the [official Debian repository](https://support.torproject.org/apt/tor-deb-repo/), or from your package manager. Then download Qt 5.14.0 for Linux: diff --git a/tests/test_cli_common.py b/tests/test_cli_common.py index 1f230295..3592d1ba 100644 --- a/tests/test_cli_common.py +++ b/tests/test_cli_common.py @@ -227,12 +227,16 @@ class TestGetTorPaths: # @pytest.mark.skipif(sys.platform != 'Linux', reason='requires Linux') ? def test_get_tor_paths_linux(self, platform_linux, common_obj): - assert common_obj.get_tor_paths() == ( - "/usr/bin/tor", - "/usr/share/tor/geoip", - "/usr/share/tor/geoip6", - "/usr/bin/obfs4proxy", - ) + ( + tor_path, + tor_geo_ip_file_path, + tor_geo_ipv6_file_path, + _, # obfs4proxy is optional + ) = common_obj.get_tor_paths() + + assert os.path.basename(tor_path) == "tor" + assert tor_geo_ip_file_path == "/usr/share/tor/geoip" + assert tor_geo_ipv6_file_path == "/usr/share/tor/geoip6" # @pytest.mark.skipif(sys.platform != 'Windows', reason='requires Windows') ? def test_get_tor_paths_windows(self, platform_windows, common_obj, sys_frozen):