All of lore.kernel.org
 help / color / mirror / Atom feed
From: ldimaggi@sourceware.org <ldimaggi@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/test conga_Helpers.py conga_suite.p ...
Date: 5 Dec 2006 21:23:52 -0000	[thread overview]
Message-ID: <20061205212352.29393.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	ldimaggi at sourceware.org	2006-12-05 21:23:51

Modified files:
	luci/test      : conga_Helpers.py conga_suite.py 
Added files:
	luci/test      : CGA_0160_Add_User.py 

Log message:
	Added first cut of new test:
	
	Test for Conga use case CGA-160 - Adding a new user (http://sourceware.org/cluster/conga/usecases/cga-0160.html)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0160_Add_User.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=1.1&r2=1.2

/cvs/cluster/conga/luci/test/CGA_0160_Add_User.py,v  -->  standard output
revision 1.1
--- conga/luci/test/CGA_0160_Add_User.py
+++ -	2006-12-05 21:23:51.935346000 +0000
@@ -0,0 +1,170 @@
+#! /usr/bin/env python
+
+'''
+Script name:    CGA_0160_Add_User.py
+Creation date:  Dec 2006
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0
+Summary:        Test for Conga use case CGA-160 - Adding a new user 
+                http://sourceware.org/cluster/conga/usecases/cga-0160.html
+                
+                The sequence of actions is:
+                
+                As admin:
+                    Login
+                    Add systems
+                    Add users
+                    Assign user to a machine
+                    Logout
+  
+                As each user:  
+                    Login
+                    Verify user view machine storage
+                    Verify user cannot view other machines
+                    Logout
+  
+                As admin:
+                    Login
+                    Delete systems
+                    Delete users
+                    Logout
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi@redhat.com>'
+
+from selenium import selenium
+import unittest, time, re
+from conga_Helpers import *
+
+class CGA_0160_Add_User (unittest.TestCase):
+
+    def setUp(self):      
+        """Establish connection to selenium server, login to luci """
+        self.verificationErrors = []
+        self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+
+        """Test to create and delete storage systems"""
+        sel = self.selenium
+
+        # Create the storage systems
+        for systemName in CONGA_STORAGE_SYSTEMS:
+            createStorageSystem(sel, systemName, CONGA_STORAGE_SYSTEMS[systemName])
+            # Validation - verify that the success message was displayed for each storage system
+            self.assertEqual("Do you really want to add the following Storage Systems:\n" + systemName, sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('Added storage system "' + systemName + '" successfully'))               
+        
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)     
+
+        # Create the users
+        for userName in CONGA_USERS.keys(): 
+            createUser (sel, userName, CONGA_USERS[userName])
+            # Validation - verify that the success message was displayed for each user
+            self.assertEqual('Do you really want to add the user "' + userName + '"?', sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('Added new user "' + userName + '" successfully')) 
+     
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)    
+
+        # Assign permissions to users as defined in CONGA_USERS_SYSTEMS
+        for userName in CONGA_USERS_SYSTEMS:
+            # Temporary - 20061205 - only tng3-2, 3-3, and 3-5 are reliable systems right now
+            if ((userName == 'user2') or (userName == 'user3') or (userName == 'user5') ):
+                systemName = CONGA_USERS_SYSTEMS[userName]
+                # Replace . with _ in system name to match HTML
+                systemNameMod = systemName.replace('.', '_')
+
+                sel.click("link=User Permissions")
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                
+                sel.select("userList", "label=" + userName)
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                sel.click("name=__SYSTEM:" + systemNameMod)
+                
+                sel.click("document.adminform.elements['Update Permissions']")
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                # The following statement is failing - not clear why - is luci not displaying the confirm dialog?
+                #self.assertEqual('Modify permissions for ' + userName, sel.get_confirmation())  - why is this failing?
+                sel.get_confirmation()
+                #print "DEBUG = " + userName + " " + systemName
+                self.assertTrue (sel.is_text_present('Added permission for ' + userName + ' for system ' + systemName))
+ 
+        # Logout as admin
+        logout(self.selenium)
+
+    def test_create_users_systems(self):
+        """Test to verify user permissions - control of access to view systems"""
+        
+        #####################################################
+        # Validation: Two part test:
+        #   1) Verify that the loggedin user can see the systems for which they have authorization
+        #   2) Verify that the loggedin user cannot see any other systems
+        for loggedInUser in CONGA_USERS:
+            self.selenium = login (loggedInUser, CONGA_USERS[loggedInUser])
+            sel = self.selenium 
+            sel.click("link=storage")
+            sel.wait_for_page_to_load("30000")
+            
+            for userName in CONGA_USERS_SYSTEMS:
+                if ((userName == 'user2') or (userName == 'user3') or (userName == 'user5') ):
+                    if (loggedInUser == userName):
+                        # Validation 1 - seeing authorized systems
+                        print 'Verify user ' + userName + ' is able to access authorized systems'
+                        self.assertTrue (sel.is_text_present(CONGA_USERS_SYSTEMS[loggedInUser]))
+                    else:
+                        # Validation 2 - not seeing other systems
+                        print 'Verify user ' + loggedInUser + ' is not able to access unauthorized system ' + CONGA_USERS_SYSTEMS[userName]
+                        self.assertFalse (sel.is_text_present(CONGA_USERS_SYSTEMS[userName]))
+                        
+            logout(self.selenium)     
+
+    def tearDown(self):        
+        # login as admin
+        self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+        sel = self.selenium 
+        
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)     
+
+        # View the defined storage systems 
+        sel.select_window("null")
+        sel.click("link=Manage Systems")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+        # Delete the storage systems
+        for systemName in CONGA_STORAGE_SYSTEMS:
+            deleteStorageSystem(sel, systemName)
+            # Validation - verify that the success message was displayed for each storage system
+            self.assertEqual("Do you really want to remove the following managed systems:\nStorage Systems:\n-" + systemName, sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+ 
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)     
+
+        # Delete the users 
+        for userName in CONGA_USERS.keys(): 
+            deleteUser (sel, userName)
+            # Validation - verify that the success message was displayed for each user
+            self.assertEqual('Do you really want to remove the user "' + userName + '"?', sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))  
+       
+        """Logout and stop Selenium session"""
+        logout(self.selenium)
+        self.assertEqual([], self.verificationErrors)
+
+def suite():
+        suite = unittest.TestSuite()
+        suite.addTest(CGA_0160_Add_User('test_create_users_systems'))
+        return suite
+
+if __name__ == "__main__":
+    #unittest.main()
+    unittest.TextTestRunner( verbosity=2 ).run( suite() )
--- conga/luci/test/conga_Helpers.py	2006/12/05 02:12:18	1.3
+++ conga/luci/test/conga_Helpers.py	2006/12/05 21:23:51	1.4
@@ -71,15 +71,15 @@
                          'user10':'user10_password'}
 
 CONGA_USERS_SYSTEMS =   {'user1':'tng3-1.lab.msp.redhat.com', 
-                         'user2':'tng3-1.lab.msp.redhat.com', 
-                         'user3':'tng3-1.lab.msp.redhat.com', 
-                         'user4':'tng3-1.lab.msp.redhat.com', 
-                         'user5':'tng3-1.lab.msp.redhat.com', 
+                         'user2':'tng3-2.lab.msp.redhat.com', 
+                         'user3':'tng3-3.lab.msp.redhat.com', 
+                         'user4':'tng3-4.lab.msp.redhat.com', 
+                         'user5':'tng3-5.lab.msp.redhat.com', 
                          'user6':'tng3-1.lab.msp.redhat.com', 
-                         'user7':'tng3-1.lab.msp.redhat.com', 
-                         'user8':'tng3-1.lab.msp.redhat.com', 
-                         'user9':'tng3-1.lab.msp.redhat.com', 
-                         'user10':'tng3-1.lab.msp.redhat.com'}
+                         'user7':'tng3-2.lab.msp.redhat.com', 
+                         'user8':'tng3-3.lab.msp.redhat.com', 
+                         'user9':'tng3-4.lab.msp.redhat.com', 
+                         'user10':'tng3-5.lab.msp.redhat.com'}
 
 def createStorageSystem(sel, systemName, systemPassword):
     """Common code to create storage systems"""
--- conga/luci/test/conga_suite.py	2006/12/01 19:57:52	1.1
+++ conga/luci/test/conga_suite.py	2006/12/05 21:23:51	1.2
@@ -30,8 +30,9 @@
 # Import the test suites
 import unittest
 import congaDemoTests
+import CGA_0160_Add_User
 
-# Tests planned - not yet complete:   
+# Tests planned - all not yet complete:   
 #   CGA-0160_Add_User.py
 #   CGA-0170_Online_Documenation_Portlet.py
 #   CGA-0180_Event_Portlet.py
@@ -57,10 +58,12 @@
 
 # Define the suite elements
 congaDemoSuite = congaDemoTests.suite()
+CGA_0160_Add_UserSuite = CGA_0160_Add_User.suite()
 
 # Assemble the suite
 suite = unittest.TestSuite()
 suite.addTest(congaDemoSuite)
+suite.addTest(CGA_0160_Add_UserSuite)
 
 # Run the test suite
 unittest.TextTestRunner(verbosity=2).run(suite)



             reply	other threads:[~2006-12-05 21:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-05 21:23 ldimaggi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-12-07 20:56 [Cluster-devel] conga/luci/test conga_Helpers.py conga_suite.p ldimaggi
2006-12-11 21:37 ldimaggi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061205212352.29393.qmail@sourceware.org \
    --to=ldimaggi@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.