def authenticate(): p = load_properties() transport = SoapTransport() transport.soap_url = soap.admin_soap_url(p[pconstant.ADMIN_HOSTNAME]) auth = SoapAuthenticator() auth_token = auth.authenticate_admin(transport, p[pconstant.ADMIN_ACCOUNT_NAME], p[pconstant.ADMIN_PASSWORD]) print auth_token.token
def get_account(): p = load_properties() zclient = ZimbraAdmin(soap.admin_soap_url(p[pconstant.ADMIN_HOSTNAME])) zclient.authenticate(p[pconstant.ADMIN_ACCOUNT_NAME], p[pconstant.ADMIN_PASSWORD]) attrs = {sconstant.A_BY: sconstant.V_NAME} account = SOAPpy.Types.stringType(data=p[pconstant.ACCOUNT_NAME], attrs=attrs) params = {sconstant.E_ACCOUNT: account} res = zclient.invoke(zconstant.NS_ZIMBRA_ADMIN_URL, sconstant.GetAccountRequest, params) print res
def testNotEmptyAdminHostnamePort(self): result = soap.admin_soap_url("localhost:8080") self.assertEqual("https://localhost:8080/service/admin/soap", result)