mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
tests passing for airport -I. Issue #46
This commit is contained in:
@ -3,7 +3,10 @@ jc - JSON CLI output utility airport Parser
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
specify --airport as the first argument if the piped input is coming from airport
|
specify --airport as the first argument if the piped input is coming from airport (OSX)
|
||||||
|
|
||||||
|
This program can be found at:
|
||||||
|
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
@ -11,7 +14,7 @@ Compatibility:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ airport | jc --airport -p
|
$ airport -I | jc --airport -p
|
||||||
{
|
{
|
||||||
"agrctlrssi": -66,
|
"agrctlrssi": -66,
|
||||||
"agrextrssi": 0,
|
"agrextrssi": 0,
|
||||||
@ -30,7 +33,7 @@ Examples:
|
|||||||
"channel": "48,80"
|
"channel": "48,80"
|
||||||
}
|
}
|
||||||
|
|
||||||
$ airport | jc --airport -p -r
|
$ airport -I | jc --airport -p -r
|
||||||
{
|
{
|
||||||
"agrctlrssi": "-66",
|
"agrctlrssi": "-66",
|
||||||
"agrextrssi": "0",
|
"agrextrssi": "0",
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
specify --airport as the first argument if the piped input is coming from airport
|
specify --airport as the first argument if the piped input is coming from airport (OSX)
|
||||||
|
|
||||||
|
This program can be found at:
|
||||||
|
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
@ -10,7 +13,7 @@ Compatibility:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ airport | jc --airport -p
|
$ airport -I | jc --airport -p
|
||||||
{
|
{
|
||||||
"agrctlrssi": -66,
|
"agrctlrssi": -66,
|
||||||
"agrextrssi": 0,
|
"agrextrssi": 0,
|
||||||
@ -29,7 +32,7 @@ Examples:
|
|||||||
"channel": "48,80"
|
"channel": "48,80"
|
||||||
}
|
}
|
||||||
|
|
||||||
$ airport | jc --airport -p -r
|
$ airport -I | jc --airport -p -r
|
||||||
{
|
{
|
||||||
"agrctlrssi": "-66",
|
"agrctlrssi": "-66",
|
||||||
"agrextrssi": "0",
|
"agrextrssi": "0",
|
||||||
|
28
tests/test_airport.py
Normal file
28
tests/test_airport.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import os
|
||||||
|
import unittest
|
||||||
|
import json
|
||||||
|
import jc.parsers.airport
|
||||||
|
|
||||||
|
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
|
class MyTests(unittest.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
# input
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/airport-I.out'), 'r', encoding='utf-8') as f:
|
||||||
|
self.osx_10_14_6_airport_I = f.read()
|
||||||
|
|
||||||
|
# output
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/airport-I.json'), 'r', encoding='utf-8') as f:
|
||||||
|
self.osx_10_14_6_airport_I_json = json.loads(f.read())
|
||||||
|
|
||||||
|
def test_airport_I_osx_10_14_6(self):
|
||||||
|
"""
|
||||||
|
Test 'airport -I' on OSX 10.14.6
|
||||||
|
"""
|
||||||
|
self.assertEqual(jc.parsers.airport.parse(self.osx_10_14_6_airport_I, quiet=True), self.osx_10_14_6_airport_I_json)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Reference in New Issue
Block a user