Skip to content

Commit ca1ed00

Browse files
committed
Stage 1 test003
1 parent 11a1e0c commit ca1ed00

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

testing/test003/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BASE_URL = 'http://jsonplaceholder.typicode.com'

testing/test003/services.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
try:
2+
from urllib.parse import urljoin
3+
except ImportError:
4+
from urlparse import urljoin
5+
6+
import requests
7+
from test003.constants import BASE_URL
8+
9+
TODOS_URL = urljoin(BASE_URL, 'todos')
10+
11+
def get_todos():
12+
response = requests.get(TODOS_URL)
13+
if response.ok:
14+
return response
15+
else:
16+
return None
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from nose.tools import assert_is_not_none
2+
from test003.services import get_todos
3+
4+
5+
def test_request_response():
6+
response = get_todos()
7+
assert_is_not_none(response)

0 commit comments

Comments
 (0)