Пример #1
0
    def test_from_string_incorrect_auth(self):
        service_url = '%s://bla@%s:%s/%s' % (PROTOCOL, HOST, PORT, XMPP_DOMAIN)

        api = None
        error_thrown = False
        try:
            api = EjabberdAPIClient.get_instance(service_url)
        except AssertionError:
            error_thrown = True
        self.assertTrue(error_thrown)
        self.assertIsNone(api)
Пример #2
0
    def test_from_string_incorrect_protocol(self):
        service_url = 'test://%s:%s@%s:%s/%s' % (USERNAME, PASSWORD, HOST, PORT, XMPP_DOMAIN)

        api = None
        error_thrown = False
        try:
            api = EjabberdAPIClient.get_instance(service_url)
        except AssertionError:
            error_thrown = True
        self.assertTrue(error_thrown)
        self.assertIsNone(api)
Пример #3
0
    def test_from_string_incorrect_auth(self):
        service_url = '%s://bla@%s:%s/%s' % (PROTOCOL, HOST, PORT, XMPP_DOMAIN)

        api = None
        error_thrown = False
        try:
            api = EjabberdAPIClient.get_instance(service_url)
        except AssertionError:
            error_thrown = True
        self.assertTrue(error_thrown)
        self.assertIsNone(api)
Пример #4
0
    def test_from_string_incorrect_protocol(self):
        service_url = 'test://%s:%s@%s:%s/%s' % (USERNAME, PASSWORD, HOST, PORT, XMPP_DOMAIN)

        api = None
        error_thrown = False
        try:
            api = EjabberdAPIClient.get_instance(service_url)
        except AssertionError:
            error_thrown = True
        self.assertTrue(error_thrown)
        self.assertIsNone(api)
Пример #5
0
    def test_from_string_default_server_port(self):
        service_url = '%s://%s:%s@%s/%s' % (PROTOCOL, USERNAME, PASSWORD, HOST, XMPP_DOMAIN)

        api = None
        error_thrown = False
        try:
            api = EjabberdAPIClient.get_instance(service_url)
        except AssertionError:
            error_thrown = True
        self.assertFalse(error_thrown)
        self.assertIsNotNone(api)
        self.assertEqual(api.port, XMLRPC_API_PORT)
Пример #6
0
    def test_from_string_ok(self):
        service_url = '%s://%s:%s@%s:%s/%s' % (PROTOCOL, USERNAME, PASSWORD,
                                               HOST, PORT, XMPP_DOMAIN)

        api = None
        error_thrown = False
        try:
            api = EjabberdAPIClient.get_instance(service_url)
        except AssertionError:
            error_thrown = True
        self.assertFalse(error_thrown)
        self.assertIsNotNone(api)