Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Ceremuga authored and Craig Ceremuga committed Nov 10, 2019
1 parent 06db19d commit 7c0c030
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ The following are required to be installed and configured on your system.
* Python >= v3.6
* [rtl_fm](http://osmocom.org/projects/sdr/wiki/rtl-sdr)
* [multimon-ng](https://github.com/EliasOenal/multimon-ng)
* [pip](https://pypi.python.org/pypi/pip) `pip install -r requirements.txt`

## Configuration

Expand All @@ -27,7 +26,8 @@ From a terminal, in the directory where you've cloned the repository...
* Ensure you have the following environment variables set:
* `PYPACKET_USERNAME` - Your call sign for APRS-IS
* `PYPACKET_PASSWORD` - Your password for APRS-IS
* Run `python main.py`.
* Run `pip install -r requirements.txt`
* Run `./main.py`.
* The application will start and immediately begin listening on the configured frequency.
* Logged packets will be output to your terminal, written to a file in the `logs` directory, and uploaded to APRS-IS.

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aprslib
pytest
pytest-cov >= 2.4.0, < 2.6
coveralls
pytest
pytest-cov >= 2.4.0, < 2.6
30 changes: 30 additions & 0 deletions tests/base/test_aprs_is_processor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from unittest import mock

from pypacket.base.aprs_is_processor import AprsIsProcessor
from pypacket.base.configuration import Configuration
from pypacket.util.logger import Logger

class TestAprsIsProcessor:
@mock.patch('aprslib.IS.connect')
def test_load_expect_connected(self, mock_connect):
test_configuration = Configuration()
test_logger = Logger()
processor = AprsIsProcessor()

processor.load(test_configuration, test_logger)

mock_connect.assert_called_once()

@mock.patch('aprslib.IS.sendall')
def test_handle_expect_handled(self, mock_handle):
test_configuration = Configuration()
test_logger = Logger()
processor = AprsIsProcessor()
processor.is_connected = True
processor.load(test_configuration, test_logger)

processor.handle(None)

mock_handle.assert_called_once()


0 comments on commit 7c0c030

Please sign in to comment.