Skip to content

Commit

Permalink
Removing requests package dependency from unit tests and using urllib…
Browse files Browse the repository at this point in the history
… instead
  • Loading branch information
kellrott committed Oct 16, 2016
1 parent 9c74482 commit c6abec0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
12 changes: 6 additions & 6 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import unittest
import uuid
import time
import requests
import urllib
import json

from common_test_util import ServerTest, get_abspath

Expand All @@ -24,14 +25,13 @@ def test_hello_world(self):
]
}

r = requests.post("http://localhost:8000/v1/jobs", json=task)
data = r.json()
u = urllib.urlopen("http://localhost:8000/v1/jobs", json.dumps(task))
data = json.loads(u.read())
job_id = data['value']

while True:
r = requests.get("http://localhost:8000/v1/jobs/%s" % (job_id))
print r.text
data = r.json()
r = urllib.urlopen("http://localhost:8000/v1/jobs/%s" % (job_id))
data = json.loads(r.read())
if data["state"] not in ['Queued', "Running"]:
break
time.sleep(1)
Expand Down
15 changes: 6 additions & 9 deletions tests/test_fileop.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import unittest
import uuid
import time
import requests
import urllib
import json

from common_test_util import ServerTest, get_abspath

Expand Down Expand Up @@ -51,14 +52,14 @@ def test_file_mount(self):
]
}

r = requests.post("http://localhost:8000/v1/jobs", json=task)
data = r.json()
u = urllib.urlopen("http://localhost:8000/v1/jobs", json.dumps(task))
data = json.loads(u.read())
print data
job_id = data['value']

for i in range(10):
r = requests.get("http://localhost:8000/v1/jobs/%s" % (job_id))
data = r.json()
r = urllib.urlopen("http://localhost:8000/v1/jobs/%s" % (job_id))
data = json.loads(r.read())
if data["state"] not in ['Queued', "Running"]:
break
time.sleep(1)
Expand All @@ -70,7 +71,3 @@ def test_file_mount(self):
i = t.split()
assert(i[0] == "fc69a359565f35bf130a127ae2ebf2da")

#assert 'logs' in data
#assert data['logs'][0]['stdout'] == "hello world\n"


0 comments on commit c6abec0

Please sign in to comment.