コード例 #1
0
    def test_parse_login_key_exceptions(self):
        """ Test for exception on invalid key """

        # Invalid XML should yield exception
        invalid_xml = 'banana'
        self.assertRaises(
            RequestKeyException,
            lambda: intershift_plugin._parse_login_key(invalid_xml)
        )

        # Empty key should raise an exception as well
        empty_key = \
            '<?XML VERSION="1.0" Encoding="UTF-8"?><xml><key value="" /></xml>'
        self.assertRaises(
            RequestKeyException,
            lambda: intershift_plugin._parse_login_key(empty_key)
        )
コード例 #2
0
    def test_parse_login_key(self):
        """ Test _parse_login_key() """

        login_key = intershift_plugin._parse_login_key(self.test_xml)

        self.assertEquals(login_key, self.test_key)