-
Notifications
You must be signed in to change notification settings - Fork 19
/
tests.py
46 lines (35 loc) · 1.47 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
import unittest
from foaas import Fuck
class FuckingTests(unittest.TestCase):
def setUp(self):
self.fuck = Fuck()
def test_url(self):
url = self.fuck.off(name='Alice', from_='Bob').url
self.assertEqual('http://foaas.herokuapp.com/off/Alice/Bob', url)
def test_url_secure(self):
secure_fuck = Fuck(secure=True)
url = secure_fuck.everything(from_='Bob', secure=True).url
self.assertEqual('https://foaas.herokuapp.com/everything/Bob', url)
def test_url_quoting(self):
url = self.fuck.donut(name='Alice!', from_='Bobby McGee').url
self.assertEqual('http://foaas.herokuapp.com/donut/Alice%21/Bobby%20McGee', url)
def test_html(self):
html = self.fuck.thanks(from_='Bob').html
self.assertIn('<h1>Fuck you very much.</h1>', html)
self.assertIn('<em>- Bob</em>', html)
def test_json(self):
json = self.fuck.life(from_='Bob').json
self.assertEqual({
'message': 'Fuck my life.',
'subtitle': '- Bob'
}, json)
def test_text(self):
text = self.fuck.thanks(from_='Bob').text
self.assertEqual('Fuck you very much. - Bob', text)
def test_random(self):
self.fuck.random(from_='Chris')
self.fuck.random(name='Tom', from_='Chris')
self.fuck.random(name='Alice', from_='Bob', company='Acme')
self.fuck.random(name='Alice', from_='Bob', reference='Clara')
if __name__ == '__main__':
unittest.main()