diff --git a/Makefile b/Makefile index 52d84f1..1c290c4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,11 @@ +all: init test lint init: - pip install -r requirements.txt + pip install -r requirements.txt test: - pytest --cov=southwest/ --cov=checkin + pytest --cov=southwest/ --cov=checkin -.PHONY: init test +lint: + pycodestyle */*.py --show-source --ignore=E501 + +.PHONY: all diff --git a/tests/checkin_test.py b/tests/checkin_test.py index b80e044..e7939c3 100644 --- a/tests/checkin_test.py +++ b/tests/checkin_test.py @@ -9,6 +9,7 @@ from tzlocal import get_localzone my_vcr = custom_vcr() + @my_vcr.use_cassette() def test_checkin(): r = southwest.Reservation('XXXXXX', 'John', 'Smith') @@ -18,12 +19,6 @@ def test_checkin(): 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() def test_openflights_api(): tzrequest = {'iata': 'LAX', diff --git a/tests/my_vcr.py b/tests/my_vcr.py index 96d3199..3746729 100644 --- a/tests/my_vcr.py +++ b/tests/my_vcr.py @@ -14,6 +14,7 @@ bad_fields = [ 'last-name' ] + def redact(obj): for k, v in list(obj.items()): if k in bad_fields: @@ -24,6 +25,7 @@ def redact(obj): elif isinstance(v, dict): redact(v) + def filter_payload(response): string_body = response['body']['string'].decode('utf8') body = json.loads(string_body) @@ -31,6 +33,7 @@ def filter_payload(response): response['body']['string'] = json.dumps(body).encode() return response + def custom_vcr(): dirname = os.path.dirname(__file__) return VCR(