mirror of
https://github.com/pyro2927/SouthwestCheckin.git
synced 2025-12-06 01:13:19 +00:00
Fixing lint issues
This commit is contained in:
10
Makefile
10
Makefile
@@ -1,7 +1,11 @@
|
|||||||
|
all: init test lint
|
||||||
init:
|
init:
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
test:
|
test:
|
||||||
pytest --cov=southwest/ --cov=checkin
|
pytest --cov=southwest/ --cov=checkin
|
||||||
|
|
||||||
.PHONY: init test
|
lint:
|
||||||
|
pycodestyle */*.py --show-source --ignore=E501
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from tzlocal import get_localzone
|
|||||||
|
|
||||||
my_vcr = custom_vcr()
|
my_vcr = custom_vcr()
|
||||||
|
|
||||||
|
|
||||||
@my_vcr.use_cassette()
|
@my_vcr.use_cassette()
|
||||||
def test_checkin():
|
def test_checkin():
|
||||||
r = southwest.Reservation('XXXXXX', 'John', 'Smith')
|
r = southwest.Reservation('XXXXXX', 'John', 'Smith')
|
||||||
@@ -18,12 +19,6 @@ def test_checkin():
|
|||||||
pytest.fail("Error checking in")
|
pytest.fail("Error checking in")
|
||||||
|
|
||||||
|
|
||||||
def test_timezone_localization():
|
|
||||||
tz = timezone('America/Los_Angeles')
|
|
||||||
date = tz.localize(datetime.strptime('2018-01-01 13:00', '%Y-%m-%d %H:%M'))
|
|
||||||
assert date.strftime('%z') == '-0800'
|
|
||||||
|
|
||||||
|
|
||||||
@my_vcr.use_cassette()
|
@my_vcr.use_cassette()
|
||||||
def test_openflights_api():
|
def test_openflights_api():
|
||||||
tzrequest = {'iata': 'LAX',
|
tzrequest = {'iata': 'LAX',
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ bad_fields = [
|
|||||||
'last-name'
|
'last-name'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def redact(obj):
|
def redact(obj):
|
||||||
for k, v in list(obj.items()):
|
for k, v in list(obj.items()):
|
||||||
if k in bad_fields:
|
if k in bad_fields:
|
||||||
@@ -24,6 +25,7 @@ def redact(obj):
|
|||||||
elif isinstance(v, dict):
|
elif isinstance(v, dict):
|
||||||
redact(v)
|
redact(v)
|
||||||
|
|
||||||
|
|
||||||
def filter_payload(response):
|
def filter_payload(response):
|
||||||
string_body = response['body']['string'].decode('utf8')
|
string_body = response['body']['string'].decode('utf8')
|
||||||
body = json.loads(string_body)
|
body = json.loads(string_body)
|
||||||
@@ -31,6 +33,7 @@ def filter_payload(response):
|
|||||||
response['body']['string'] = json.dumps(body).encode()
|
response['body']['string'] = json.dumps(body).encode()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def custom_vcr():
|
def custom_vcr():
|
||||||
dirname = os.path.dirname(__file__)
|
dirname = os.path.dirname(__file__)
|
||||||
return VCR(
|
return VCR(
|
||||||
|
|||||||
Reference in New Issue
Block a user