cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [35/50] [abbrv] git commit: updated refs/heads/reporter to b26f3fc
Date Fri, 02 Jan 2015 14:36:27 GMT
CLOUDSTACK-8116: Moved ldap data to configurableData section in test_data.py and made related
changes in the test case

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0ed40140
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0ed40140
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0ed40140

Branch: refs/heads/reporter
Commit: 0ed40140a67737c91a8e2ab15b3d55073c8eedf7
Parents: f420dd5
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Tue Dec 23 17:29:31 2014 +0530
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Wed Dec 24 11:10:18 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_ldap.py | 122 ++++++++++++++++-----------
 tools/marvin/marvin/config/test_data.py |  35 ++++----
 2 files changed, 88 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed40140/test/integration/component/test_ldap.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ldap.py b/test/integration/component/test_ldap.py
index 5a78957..3464022 100644
--- a/test/integration/component/test_ldap.py
+++ b/test/integration/component/test_ldap.py
@@ -20,22 +20,19 @@
 
 
 #!/usr/bin/env python
-
-import marvin
-from marvin import cloudstackTestCase
-from marvin.cloudstackTestCase import *
-import unittest
-import hashlib
-import random
-from marvin.cloudstackAPI import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (updateConfiguration,
+                                  createAccount,
+                                  deleteAccount,
+                                  addLdapConfiguration,
+                                  deleteLdapConfiguration)
 from marvin.cloudstackAPI import login
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.lib.utils import cleanup_resources
 from nose.plugins.attrib import attr
-import urllib
+
 
 class TestLdap(cloudstackTestCase):
+
     """
     This tests attempts to register a LDAP server and authenticate as an LDAP user.
     """
@@ -46,11 +43,8 @@ class TestLdap(cloudstackTestCase):
         testClient = super(TestLdap, cls).getClsTestClient()
         cls.api_client = testClient.getApiClient()
         cls.services = testClient.getParsedTestDataConfig()
-        cls.account = cls.services["ldap_account"]
         cls._cleanup = []
 
-
-
     @classmethod
     def tearDownClass(cls):
         try:
@@ -66,12 +60,18 @@ class TestLdap(cloudstackTestCase):
 
         self.acct = createAccount.createAccountCmd()
         self.acct.accounttype = 0
-        self.acct.firstname = self.services["ldap_account"]["firstname"]
-        self.acct.lastname = self.services["ldap_account"]["lastname"]
-        self.acct.password = self.services["ldap_account"]["password"]
-        self.acct.username = self.services["ldap_account"]["username"]
-        self.acct.email = self.services["ldap_account"]["email"]
-        self.acct.account = self.services["ldap_account"]["username"]
+        self.acct.firstname = self.services[
+            "configurableData"]["ldap_account"]["firstname"]
+        self.acct.lastname = self.services[
+            "configurableData"]["ldap_account"]["lastname"]
+        self.acct.password = self.services[
+            "configurableData"]["ldap_account"]["password"]
+        self.acct.username = self.services[
+            "configurableData"]["ldap_account"]["username"]
+        self.acct.email = self.services[
+            "configurableData"]["ldap_account"]["email"]
+        self.acct.account = self.services[
+            "configurableData"]["ldap_account"]["username"]
         self.acct.domainid = 1
 
         self.acctRes = self.apiClient.createAccount(self.acct)
@@ -84,14 +84,17 @@ class TestLdap(cloudstackTestCase):
             deleteAcct = deleteAccount.deleteAccountCmd()
             deleteAcct.id = self.acctRes.id
 
-            acct_name=self.acctRes.name
+            acct_name = self.acctRes.name
 
             self.apiClient.deleteAccount(deleteAcct)
 
-            self.debug("Deleted the the following account name %s:" %acct_name)
+            self.debug(
+                "Deleted the the following account name %s:" %
+                acct_name)
 
-            if(self.ldapconfRes==1):
-                self._deleteLdapConfiguration(self.services["ldapConfiguration_1"])
+            if(self.ldapconfRes == 1):
+                self._deleteLdapConfiguration(
+                    self.services["configurableData"]["ldap_configuration"])
 
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -103,30 +106,33 @@ class TestLdap(cloudstackTestCase):
         This test configures LDAP and attempts to authenticate as a user.
         """
 
-
         self.debug("start test")
 
-        self.ldapconfRes=self._addLdapConfiguration(self.services["ldapConfiguration_1"])
+        self.ldapconfRes = self._addLdapConfiguration(
+            self.services["configurableData"]["ldap_configuration"])
 
-        if(self.ldapconfRes==1):
+        if(self.ldapconfRes == 1):
 
             self.debug("Ldap Configuration was succcessful")
 
-            loginRes = self._checkLogin(self.services["ldapConfiguration_1"]["ldapUsername"],self.services["ldapConfiguration_1"]["ldapPassword"])
+            loginRes = self._checkLogin(
+                self.services["configurableData"]["ldap_configuration"]["ldapUsername"],
+                self.services["configurableData"]["ldap_configuration"]["ldapPassword"])
             self.debug(loginRes)
-            self.assertEquals(loginRes,1,"Ldap Authentication")
+            self.assertEquals(loginRes, 1, "Ldap Authentication")
 
         else:
 
             self.debug("LDAP Configuration failed with exception")
 
-            self.assertEquals(self.ldapconfRes,1,"addLdapConfiguration failed")
-
+            self.assertEquals(
+                self.ldapconfRes,
+                1,
+                "addLdapConfiguration failed")
 
         self.debug("end test")
 
-    def _addLdapConfiguration(self,ldapConfiguration):
-
+    def _addLdapConfiguration(self, ldapConfiguration):
         """
 
         :param ldapConfiguration
@@ -138,27 +144,42 @@ class TestLdap(cloudstackTestCase):
         updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
         updateConfigurationCmd.name = "ldap.basedn"
         updateConfigurationCmd.value = ldapConfiguration['basedn']
-        updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)
-        self.debug("updated the parameter %s with value %s"%(updateConfigurationResponse.name,
updateConfigurationResponse.value))
+        updateConfigurationResponse = self.apiClient.updateConfiguration(
+            updateConfigurationCmd)
+        self.debug(
+            "updated the parameter %s with value %s" %
+            (updateConfigurationResponse.name,
+             updateConfigurationResponse.value))
 
         updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
         updateConfigurationCmd.name = "ldap.email.attribute"
         updateConfigurationCmd.value = ldapConfiguration['emailAttribute']
-        updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)
-        self.debug("updated the parameter %s with value %s"%(updateConfigurationResponse.name,
updateConfigurationResponse.value))
+        updateConfigurationResponse = self.apiClient.updateConfiguration(
+            updateConfigurationCmd)
+        self.debug(
+            "updated the parameter %s with value %s" %
+            (updateConfigurationResponse.name,
+             updateConfigurationResponse.value))
 
         updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
         updateConfigurationCmd.name = "ldap.user.object"
         updateConfigurationCmd.value = ldapConfiguration['userObject']
-        updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)
-        self.debug("updated the parameter %s with value %s"%(updateConfigurationResponse.name,
updateConfigurationResponse.value))
-
+        updateConfigurationResponse = self.apiClient.updateConfiguration(
+            updateConfigurationCmd)
+        self.debug(
+            "updated the parameter %s with value %s" %
+            (updateConfigurationResponse.name,
+             updateConfigurationResponse.value))
 
         updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
         updateConfigurationCmd.name = "ldap.username.attribute"
         updateConfigurationCmd.value = ldapConfiguration['usernameAttribute']
-        updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)
-        self.debug("updated the parameter %s with value %s"%(updateConfigurationResponse.name,
updateConfigurationResponse.value))
+        updateConfigurationResponse = self.apiClient.updateConfiguration(
+            updateConfigurationCmd)
+        self.debug(
+            "updated the parameter %s with value %s" %
+            (updateConfigurationResponse.name,
+             updateConfigurationResponse.value))
 
         self.debug("start addLdapConfiguration test")
 
@@ -171,12 +192,11 @@ class TestLdap(cloudstackTestCase):
             self.apiClient.addLdapConfiguration(ldapServer)
             self.debug("addLdapConfiguration was successful")
             return 1
-        except Exception, e:
-            self.debug("addLdapConfiguration failed %s" %e)
+        except Exception as e:
+            self.debug("addLdapConfiguration failed %s" % e)
             return 0
 
-    def _deleteLdapConfiguration(self,ldapConfiguration):
-
+    def _deleteLdapConfiguration(self, ldapConfiguration):
         """
 
         :param ldapConfiguration
@@ -190,8 +210,8 @@ class TestLdap(cloudstackTestCase):
             self.apiClient.deleteLdapConfiguration(ldapServer)
             self.debug("deleteLdapConfiguration was successful")
             return 1
-        except Exception, e:
-            self.debug("deleteLdapConfiguration failed %s" %e)
+        except Exception as e:
+            self.debug("deleteLdapConfiguration failed %s" % e)
             return 0
 
     def _checkLogin(self, username, password):
@@ -216,6 +236,6 @@ class TestLdap(cloudstackTestCase):
                 self.debug("login successful")
                 return 1
 
-        except Exception, p:
-            self.debug("login operation failed %s" %p)
+        except Exception as p:
+            self.debug("login operation failed %s" % p)
         self.debug("end of Login")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed40140/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index f123dd0..d5ed353 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -1391,24 +1391,6 @@ test_data = {
                 },
                 "ostype": 'CentOS 5.6 (64-bit)',
         },
-        "ldap_account": {
-            "email": "rmurphy@cloudstack.org",
-            "firstname": "Ryan",
-            "lastname": "Murphy",
-            "username": "rmurphy",
-            "password": "internalcloudstackpassword",
-            },
-        "ldapConfiguration_1": {
-            "basedn": "dc=cloudstack,dc=org",
-            "emailAttribute": "mail",
-            "userObject": "inetOrgPerson",
-            "usernameAttribute": "uid",
-            "hostname": "localhost",
-            "port": "10389",
-            "ldapUsername": "rmurphy",
-            "ldapPassword": "password"
-            },
-
       "test_34_DeployVM_in_SecondSGNetwork": {
           "zone": "advsg",
           "config": "D:\ACS-Repo\setup\dev\\advancedsg.cfg",#Absolute path to cfg file
@@ -1469,6 +1451,23 @@ test_data = {
                  "username": "root",
                  "password": "password",
         },
+       "ldap_account": {
+            "email": "",
+            "firstname": "",
+            "lastname": "",
+            "username": "",
+            "password": "",
+        },
+        "ldap_configuration": {
+            "basedn": "",
+            "emailAttribute": "",
+            "userObject": "",
+            "usernameAttribute": "",
+            "hostname": "",
+            "port": "",
+            "ldapUsername": "",
+            "ldapPassword": ""
+        },
         "systemVmDelay": 120
     }
 }


Mime
View raw message