2019-05-23 09:28:51 +00:00
|
|
|
import json
|
2019-05-23 12:19:43 +00:00
|
|
|
from app.simple import app
|
2019-05-23 09:28:51 +00:00
|
|
|
|
|
|
|
class TestSimple:
|
|
|
|
|
|
|
|
def setup(self):
|
2019-05-23 12:19:43 +00:00
|
|
|
self.app = app.test_client()
|
2019-05-23 09:28:51 +00:00
|
|
|
|
|
|
|
def teardown(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_version(self):
|
|
|
|
resp = self.app.get('/version')
|
|
|
|
rjson = json.loads(resp.data)
|
|
|
|
assert rjson['version'] == 0.1
|
|
|
|
|
|
|
|
def test_random_numbers(self):
|
|
|
|
resp = self.app.get('/randoms')
|
|
|
|
rjson = json.loads(resp.data)
|
|
|
|
assert rjson['number'] <= 80
|
|
|
|
|
|
|
|
def test_random_string(self):
|
|
|
|
resp = self.app.get('/randoms')
|
|
|
|
rjson = json.loads(resp.data)
|
|
|
|
assert len(rjson['string']) <= 80
|