File tree Expand file tree Collapse file tree 6 files changed +36
-83
lines changed Expand file tree Collapse file tree 6 files changed +36
-83
lines changed Original file line number Diff line number Diff line change @@ -26,3 +26,4 @@ __pycache__
2626example.pdf
2727TODO.txt
2828twilio.env
29+ prism
Original file line number Diff line number Diff line change 11dist : xenial # required for Python >= 3.7
22language : python
33cache : pip
4- python :
5- - ' 2.7'
6- - ' 3.5'
7- - ' 3.6'
8- - ' 3.7'
9- - ' 3.8'
4+ services :
5+ - docker
106env :
7+ matrix :
8+ - version=2.7
9+ - version=3.5
10+ - version=3.6
11+ - version=3.7
12+ - version=3.8
1113 global :
12- - CC_TEST_REPORTER_ID=$TRAVIS_CODE_CLIMATE_TOKEN SENDGRID_API_KEY=SGAPIKEY
13- install :
14- - make install
15- - make test-install
14+ - CC_TEST_REPORTER_ID=$TRAVIS_CODE_CLIMATE_TOKEN
1615before_script :
17- - " ./test/prism.sh &"
18- - sleep 20
1916 - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
2017 - chmod +x ./cc-test-reporter
2118 - ./cc-test-reporter before-build
2219script :
23- - . venv/bin/activate; coverage run -m unittest discover
20+ - make test-docker
2421after_script :
22+ - make test-install
2523 - . venv/bin/activate; codecov
2624 - ./cc-test-reporter after-build --exit-code $?
2725deploy :
@@ -32,7 +30,7 @@ deploy:
3230 distributions : sdist bdist_wheel
3331 on :
3432 tags : true
35- python : ' 3.6'
33+ condition : $version= 3.6
3634
3735notifications :
3836 slack :
Original file line number Diff line number Diff line change 1+ ARG version=latest
2+ FROM python:$version
3+
4+ RUN pip install virtualenv
5+
6+ COPY prism/prism/nginx/cert.crt /usr/local/share/ca-certificates/cert.crt
7+ RUN update-ca-certificates
8+
9+ WORKDIR /app
10+ COPY . .
11+
12+ RUN make install
Original file line number Diff line number Diff line change 1- .PHONY : venv install test-install test clean nopyc
1+ .PHONY : venv install test-install test test-integ test-docker clean nopyc
22
33venv :
44 @python --version || (echo " Python is not installed, please install Python 2 or Python 3" ; exit 1);
@@ -8,13 +8,17 @@ install: venv
88 . venv/bin/activate; python setup.py install
99 . venv/bin/activate; pip install -r requirements.txt
1010
11- test-install :
11+ test-install : install
1212 . venv/bin/activate; pip install -r test/requirements.txt
1313
1414test : test-install
15- ./test/prism.sh &
16- sleep 2
17- . venv/bin/activate; python -m unittest discover -v
15+
16+ test-integ : test
17+ . venv/bin/activate; coverage run -m unittest discover
18+
19+ version ?= latest
20+ test-docker :
21+ curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/prism/prism.sh | version=$(version ) bash
1822
1923clean : nopyc
2024 rm -rf venv
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 55import sendgrid
66from sendgrid .helpers .endpoints .ip .unassigned import unassigned
77
8- host = "http://localhost:4010"
9-
108
119class UnitTests (unittest .TestCase ):
1210
1311 @classmethod
1412 def setUpClass (cls ):
15- cls .host = host
1613 cls .path = '{}{}' .format (
1714 os .path .abspath (
1815 os .path .dirname (__file__ )), '/..' )
19- cls .sg = sendgrid .SendGridAPIClient (host = host )
16+ cls .sg = sendgrid .SendGridAPIClient ()
2017 cls .devnull = open (os .devnull , 'w' )
2118
2219 def test_api_key_init (self ):
@@ -34,7 +31,6 @@ def test_api_key_setter(self):
3431 def test_impersonate_subuser_init (self ):
3532 temp_subuser = 'abcxyz@this.is.a.test.subuser'
3633 sg_impersonate = sendgrid .SendGridAPIClient (
37- host = host ,
3834 impersonate_subuser = temp_subuser )
3935 self .assertEqual (sg_impersonate .impersonate_subuser , temp_subuser )
4036
@@ -43,7 +39,7 @@ def test_useragent(self):
4339 self .assertEqual (self .sg .useragent , useragent )
4440
4541 def test_host (self ):
46- self .assertEqual (self .sg .host , self . host )
42+ self .assertEqual (self .sg .host , 'https://api.sendgrid.com' )
4743
4844 def test_get_default_headers (self ):
4945 headers = self .sg ._default_headers
You can’t perform that action at this time.
0 commit comments