예제 #1
0
class FuckingTests(unittest.TestCase):
    def setUp(self):
        self.f**k = F**k()

    def test_url(self):
        url = self.f**k.off(name='Alice', from_='Bob').url
        self.assertEqual('http://foaas.herokuapp.com/off/Alice/Bob', url)

    def test_url_secure(self):
        secure_fuck = F**k(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.f**k.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.f**k.thanks(from_='Bob').html
        self.assertIn('<h1>F**k you very much.</h1>', html)
        self.assertIn('<em>- Bob</em>', html)

    def test_json(self):
        json = self.f**k.life(from_='Bob').json
        self.assertEqual({
            'message': 'F**k my life.',
            'subtitle': '- Bob'
        }, json)

    def test_text(self):
        text = self.f**k.thanks(from_='Bob').text
        self.assertEqual('F**k you very much. - Bob', text)

    def test_random(self):
        self.f**k.random(from_='Chris')
        self.f**k.random(name='Tom', from_='Chris')
        self.f**k.random(name='Alice', from_='Bob', company='Acme')
        self.f**k.random(name='Alice', from_='Bob', reference='Clara')
예제 #2
0
class FuckingTests(unittest.TestCase):
    def setUp(self):
        self.f**k = F**k()

    def test_url(self):
        url = self.f**k.off(name='Alice', from_='Bob').url
        self.assertEqual('http://foaas.herokuapp.com/off/Alice/Bob', url)

    def test_url_secure(self):
        secure_fuck = F**k(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.f**k.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.f**k.thanks(from_='Bob').html
        self.assertIn('<h1>F**k you very much.</h1>', html)
        self.assertIn('<em>- Bob</em>', html)

    def test_json(self):
        json = self.f**k.life(from_='Bob').json
        self.assertEqual({
            'message': 'F**k my life.',
            'subtitle': '- Bob'
        }, json)

    def test_text(self):
        text = self.f**k.thanks(from_='Bob').text
        self.assertEqual('F**k you very much. - Bob', text)

    def test_random(self):
        self.f**k.random(from_='Chris')
        self.f**k.random(name='Tom', from_='Chris')
        self.f**k.random(name='Alice', from_='Bob', company='Acme')
        self.f**k.random(name='Alice', from_='Bob', reference='Clara')