-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6819086
commit 22d0823
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import unittest2 as unittest | ||
|
||
from aprslib.parsing.misc import parse_status, parse_invalid, parse_user_defined | ||
|
||
|
||
class MiscTC(unittest.TestCase): | ||
def test_status(self): | ||
body = "test status text " | ||
_, result = parse_status('>', body) | ||
|
||
self.assertEqual(result['format'], 'status') | ||
self.assertEqual(result['status'], 'test status text') | ||
|
||
# with timestamp | ||
body = "111111ztest status text " | ||
_, result = parse_status('>', body) | ||
|
||
self.assertEqual(result['format'], 'status') | ||
self.assertEqual(result['status'], 'test status text') | ||
self.assertTrue('timestamp' in result) | ||
|
||
def test_invalid(self): | ||
body = "invalid packet text" | ||
_, result = parse_invalid(body) | ||
|
||
self.assertEqual(result['format'], 'invalid') | ||
self.assertEqual(result['body'], body) | ||
|
||
def test_user_defined(self): | ||
body = "{zinvalid packet text" | ||
_, result = parse_user_defined(body) | ||
|
||
self.assertEqual(result['format'], 'user-defined') | ||
self.assertEqual(result['body'], body[2:]) | ||
self.assertEqual(result['id'], body[0]) | ||
self.assertEqual(result['type'], body[1]) | ||
|
||
|