modifying test client method call
This commit is contained in:
parent
d0a0627468
commit
caa98a0908
@ -1,6 +1,7 @@
|
||||
import tempfile
|
||||
import unittest
|
||||
import os
|
||||
from json import loads
|
||||
from ITPlanning.config import DefaultConfig
|
||||
from ITPlanning.db import init_database, release_database
|
||||
from ITPlanning.app import create_app
|
||||
@ -32,8 +33,13 @@ class APITestBase(TestBase):
|
||||
if not isinstance(args, dict):
|
||||
raise TypeError("'args', expecting a dict, got " + type(args).__name__)
|
||||
uri = "/api/v1/{}".format(endpoint)
|
||||
method = getattr(self.client, method)
|
||||
rv = method(uri, data=args, follow_redirects=True)
|
||||
print(rv.data)
|
||||
if method == "get":
|
||||
rv = self.client.get(uri, query_string=args, follow_redirects=True)
|
||||
if method == "post":
|
||||
rv = self.client.post(uri, data=args, follow_redirects=True)
|
||||
if return_code == 200:
|
||||
data = loads(rv.data)
|
||||
else:
|
||||
data = None
|
||||
self.assertEqual(rv.status_code, return_code)
|
||||
return rv
|
||||
return rv, data
|
||||
|
Loading…
Reference in New Issue
Block a user