Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Update test script
Browse files Browse the repository at this point in the history
  • Loading branch information
alviezhang committed Feb 26, 2020
1 parent 3411d5f commit 7893c77
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 21 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: python
install: "make"

python:
- "3.5"
- "3.6"
Expand All @@ -7,8 +9,7 @@ python:
- "pypy3"

install:
- pip install -r requirements-dev.txt
- pip install .
- make install

script:
- py.test -v --capture=sys
- make test
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.PHONY: docs clean

install:
pip install -r requirements.txt
pip install --upgrade .
pip install -r requirements-dev.txt

test:
py.test
cd tests && py.test

record:
py.test --vcr-record=new_episodes
cd tests && py.test --vcr-record=new_episodes

flake8:
flake8
Expand All @@ -18,6 +19,7 @@ docs:

build:
python setup.py sdist --formats=gztar,zip
python setup.py sdist bdist_wheel

clean:
-rm -r docs/_build
Expand Down
2 changes: 1 addition & 1 deletion aftership/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../VERSION')) as f:
__version__ = f.read()
__version__ = f.read().strip()


api_key = None
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
-r requirements.txt

# For packaging
wheel
setuptools
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bdist_wheel]
universal = 1
universal = 0

[metadata]
license_file = LICENSE
license_file = LICENSE
19 changes: 10 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import os
from codecs import open # To use a consistent encoding
from os import path

from setuptools import setup

here = path.abspath(path.dirname(__file__))
here = os.path.abspath(os.path.dirname(__file__))

# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

with open(path.join(here, 'VERSION'), encoding='utf-8') as f:
version = f.read()

with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
with open(os.path.join(here, 'requirements.txt'), encoding='utf-8') as f:
install_requires = f.read().split('\n')

with open(os.path.join(here, 'VERSION'), encoding='utf-8') as f:
__version__ = f.read().strip()

setup(
name='aftership',

python_requires='>3.5.0',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version=version,
version=__version__,

description='Python SDK of AfterShip API',
long_description=long_description,
Expand All @@ -31,7 +32,7 @@
url='https://github.com/AfterShip/aftership-python',

# Download path
download_url='https://github.com/AfterShip/aftership-python/tarball/{}'.format(version),
download_url='https://github.com/AfterShip/aftership-python/tarball/{}'.format(__version__),

# Author details
author='AfterShip',
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@pytest.fixture(scope='session')
def vcr_config():
return {
'cassette_library_dir': 'tests/fixtures/cassettes',
'cassette_library_dir': 'fixtures/cassettes',
'serializer': 'yaml',
'filter_headers': [('aftership-api-key', 'YOUR_API_KEY_IS_HERE')],
'record_mode': 'none',
Expand Down
73 changes: 73 additions & 0 deletions tests/fixtures/cassettes/TrackingTestCase.test_list_trackings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,77 @@ interactions:
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- python-requests/2.23.0
aftership-api-key:
- YOUR_API_KEY_IS_HERE
method: GET
uri: https://api.aftership.com/v4/trackings?slug=4px&limit=1
response:
body:
string: !!binary |
H4sIAAAAAAAAA4VUy27bMBD8F15rA5RcO7G+IMceegsCgqbWMiu+ykdjw/C/d/W0ZLkpoAM1uyRn
Z2d5JRoiJ8WVCFsCKXJKbytS8g5zvEIsWxEltYztSthkcJXvt3S/W5EaLp/Wl6QgZEWCShWuvrsz
/lgvK2lI8f6B50GI0vAobQ9EXnVbjhJUGbq18MAjlIxHppudJKfZfp1l6/z1J90U2x1+3ygtKH1I
5uc2Oadrmq/z3TJZ8RBZcmW/gxQmKbUiHmLyhkXLApgSfMcNK/QSPJuQZm3V/sJksJu+As9FLU2F
3N+vRDYKOE1hczydf202oqxf8gDRXWi+nbF9yjQbmU5Jfpm4KOnL7IEtM0kfmkLJ21u2z3f0NXt5
bBwXUf7BtkefAP9M6W1TXitNCtFqNjStU7EDUTDDNQxgCQoPQcWinIL/UrQ/6b/Kd3mguVShowRn
B6LRYLhxSJK2zzA2jgzQqnh+U878nzkeT3ewce7Tm8NJOg0mYr6ocThYPw6PUSnq5FjTnEVsVOZp
NF7cEvwEWZ2Wt3QwS0beY7IyqMVhVCHoAL0OAdUVeDjhTpJhBH+g8dEXjQfSYQYxSrMRZhpCaB+D
yY4oo4JHK7VOQwq9MLR3qpYK2OjCkJyzHrs20FTcVKk9v/vHmn4n3GBraB6CEpwH0Vi9maUTiNpZ
aeJQWDoE4eUBb52We0enflnO/JGrAIMVnLdahomdZm26u3rSpr7Zyor+gZvBU/eN9XPRyjNO40N4
bsBF+Ml4LHLwXV5gzobIFese+odYY6pZqfdIHNHbx+32FyJiU6ExBgAA
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Headers:
- Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,aftership-api-key
Access-Control-Allow-Methods:
- GET,OPTIONS
Access-Control-Allow-Origin:
- '*'
Cache-Control:
- no-store, no-cache, must-revalidate, proxy-revalidate
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 26 Feb 2020 03:56:56 GMT
Expires:
- '0'
Pragma:
- no-cache
Server:
- nginx
Surrogate-Control:
- no-store
Vary:
- Accept-Encoding
X-RateLimit-Limit:
- '10000'
X-RateLimit-Remaining:
- '9992'
X-RateLimit-Reset:
- '1582689439'
X-Response-Time:
- 244.104ms
p3p:
- 'CP="AfterShip does not have a P3P policy. Learn why here: https://www.aftership.com/p3p"'
transfer-encoding:
- chunked
status:
code: 200
message: OK
version: 1

0 comments on commit 7893c77

Please sign in to comment.