-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
54 lines (39 loc) · 1.38 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import unittest
from stackato import restclient
class MockRestClient(restclient.RestClient):
class requests(object):
@classmethod
def session(cls, headers, verify):
cls.init = [headers, verify]
return cls
headers = {}
@classmethod
def request(cls, method, url, return_response=False):
return cls.request_obj
class request_obj(object):
headers = {'Content-Type': ''}
@classmethod
def send(cls, prefetch):
pass
response = None
class RestClientTests(unittest.TestCase):
def test_init(self):
client = MockRestClient()
self.assertEqual(client.requests.init,
[{'Pragma': 'no-cache', 'Cache-Control': 'no-cache'},
False])
def test_target(self):
client = MockRestClient()
self.assertEqual(client.target, 'https://api.127.0.0.1.xip.io')
def test_headers(self):
client = MockRestClient()
self.assertEqual(client.headers, {})
def test_request(self):
client = MockRestClient()
client.request('foo', 'bar')
class ExceptionsTests(unittest.TestCase):
def test_it(self):
from stackato import exceptions
class StackatoClientTests(unittest.TestCase):
def test_it(self):
from stackato import stackatoclient