File tree 6 files changed +36
-83
lines changed
6 files changed +36
-83
lines changed Original file line number Diff line number Diff line change @@ -26,3 +26,4 @@ __pycache__
26
26
example.pdf
27
27
TODO.txt
28
28
twilio.env
29
+ prism
Original file line number Diff line number Diff line change 1
1
dist : xenial # required for Python >= 3.7
2
2
language : python
3
3
cache : pip
4
- python :
5
- - ' 2.7'
6
- - ' 3.5'
7
- - ' 3.6'
8
- - ' 3.7'
9
- - ' 3.8'
4
+ services :
5
+ - docker
10
6
env :
7
+ matrix :
8
+ - version=2.7
9
+ - version=3.5
10
+ - version=3.6
11
+ - version=3.7
12
+ - version=3.8
11
13
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
16
15
before_script :
17
- - " ./test/prism.sh &"
18
- - sleep 20
19
16
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
20
17
- chmod +x ./cc-test-reporter
21
18
- ./cc-test-reporter before-build
22
19
script :
23
- - . venv/bin/activate; coverage run -m unittest discover
20
+ - make test-docker
24
21
after_script :
22
+ - make test-install
25
23
- . venv/bin/activate; codecov
26
24
- ./cc-test-reporter after-build --exit-code $?
27
25
deploy :
@@ -32,7 +30,7 @@ deploy:
32
30
distributions : sdist bdist_wheel
33
31
on :
34
32
tags : true
35
- python : ' 3.6'
33
+ condition : $version= 3.6
36
34
37
35
notifications :
38
36
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
2
2
3
3
venv :
4
4
@python --version || (echo " Python is not installed, please install Python 2 or Python 3" ; exit 1);
@@ -8,13 +8,17 @@ install: venv
8
8
. venv/bin/activate; python setup.py install
9
9
. venv/bin/activate; pip install -r requirements.txt
10
10
11
- test-install :
11
+ test-install : install
12
12
. venv/bin/activate; pip install -r test/requirements.txt
13
13
14
14
test : 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
18
22
19
23
clean : nopyc
20
24
rm -rf venv
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 5
5
import sendgrid
6
6
from sendgrid .helpers .endpoints .ip .unassigned import unassigned
7
7
8
- host = "http://localhost:4010"
9
-
10
8
11
9
class UnitTests (unittest .TestCase ):
12
10
13
11
@classmethod
14
12
def setUpClass (cls ):
15
- cls .host = host
16
13
cls .path = '{}{}' .format (
17
14
os .path .abspath (
18
15
os .path .dirname (__file__ )), '/..' )
19
- cls .sg = sendgrid .SendGridAPIClient (host = host )
16
+ cls .sg = sendgrid .SendGridAPIClient ()
20
17
cls .devnull = open (os .devnull , 'w' )
21
18
22
19
def test_api_key_init (self ):
@@ -34,7 +31,6 @@ def test_api_key_setter(self):
34
31
def test_impersonate_subuser_init (self ):
35
32
temp_subuser = '[email protected] '
36
33
sg_impersonate = sendgrid .SendGridAPIClient (
37
- host = host ,
38
34
impersonate_subuser = temp_subuser )
39
35
self .assertEqual (sg_impersonate .impersonate_subuser , temp_subuser )
40
36
@@ -43,7 +39,7 @@ def test_useragent(self):
43
39
self .assertEqual (self .sg .useragent , useragent )
44
40
45
41
def test_host (self ):
46
- self .assertEqual (self .sg .host , self . host )
42
+ self .assertEqual (self .sg .host , 'https://api.sendgrid.com' )
47
43
48
44
def test_get_default_headers (self ):
49
45
headers = self .sg ._default_headers
You can’t perform that action at this time.
0 commit comments