File: test_services.py

package info (click to toggle)
python3-openid 3.0.2%2Bgit20140828-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,672 kB
  • ctags: 2,679
  • sloc: python: 17,137; xml: 234; sh: 15; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import unittest

from openid.yadis import services
from openid.yadis.discover import DiscoveryFailure, DiscoveryResult


class TestGetServiceEndpoints(unittest.TestCase):
    def setUp(self):
        self.orig_discover = services.discover
        services.discover = self.discover

    def tearDown(self):
        services.discover = self.orig_discover

    def discover(self, input_url):
        result = DiscoveryResult(input_url)
        result.response_text = "This is not XRDS text."
        return result

    def test_catchXRDSError(self):
        self.assertRaises(DiscoveryFailure,
                              services.getServiceEndpoints,
                              "http://example.invalid/sometest")