cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
cm_networks_test.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 # -*- coding: utf-8 -*-
21 ##
22 # @package src.wi.tests.cm_networks_test
23 #
24 # @author Piotr W√≥jcik
25 # @author Krzysztof Danielowski
26 # @date 09.01.2013
27 #
28 
29 from wi.tests import WiTestCase
30 import unittest
31 
32 
33 class CMNetworksTests(WiTestCase, unittest.TestCase):
34 
35  @staticmethod
36  def _test_add_pool(self):
37  driver = self.driver
38  self.base_url = self.TEST_SERVER
39 
40  self.login_testuser(self.TEST_admin_cm)
41  self.login_cm_testuser()
42 
43  driver.get(self.base_url + "/admin_cm/pools/")
44 
45  self.wait_for_text("//table[@id='item-list']/tfoot/tr/td/ul/li/a", ["Add pool"])
46 
47  driver.find_element_by_link_text("Add pool").click()
48 
49  self.wait_for_text("//div[@id='dialog-div']/form/div/fieldset/div/span", ["Pool address"])
50 
51  driver.find_element_by_id("id_address").clear()
52  driver.find_element_by_id("id_address").send_keys("10.10.127.0")
53  driver.find_element_by_id("id_mask").clear()
54  driver.find_element_by_id("id_mask").send_keys("24")
55  driver.find_element_by_css_selector("button.ok-button.mid_button").click()
56 
57  self.wait_for_message(["You have successfully added a pool."])
58 
59  driver.find_element_by_link_text("Logout from CM").click()
60  driver.find_element_by_link_text("Logout").click()
61 
62  @staticmethod
63  def _test_unlock_pool(self):
64  driver = self.driver
65  self.base_url = self.TEST_SERVER
66 
67  self.login_testuser(self.TEST_admin_cm)
68  self.login_cm_testuser()
69 
70  driver.get(self.base_url + "/admin_cm/pools/")
71 
72  self.wait_for_text("//table[@id='item-list']/tbody", ["10.10.127.0"])
73 
74  self.menu_click("Address", "10.10.127.0", "Unlock")
75 
76  self.wait_for_text("//div[@id='dialog-div']/p", ["Do you want to unlock pool"])
77 
78  driver.find_element_by_css_selector("button.ok-button.mid_button").click()
79 
80  self.wait_for_message(["You have successfully unlocked pool"])
81 
82  driver.find_element_by_link_text("Logout from CM").click()
83  driver.find_element_by_link_text("Logout").click()
84 
85  def _test_lock_pool(self):
86  driver = self.driver
87  self.base_url = self.TEST_SERVER
88 
89  self.login_testuser(self.TEST_admin_cm)
90  self.login_cm_testuser()
91 
92  driver.get(self.base_url + "/admin_cm/pools/")
93 
94  self.wait_for_text("//table[@id='item-list']/tbody", ["10.10.127.0"])
95 
96  self.menu_click("Address", "10.10.127.0", "Lock")
97 
98  self.wait_for_text("//div[@id='dialog-div']/p", ["Do you want to lock pool"])
99 
100  driver.find_element_by_css_selector("button.ok-button.mid_button").click()
101 
102  self.wait_for_message(["You have successfully locked pool"])
103 
104  driver.find_element_by_link_text("Logout from CM").click()
105  driver.find_element_by_link_text("Logout").click()
106 
107  @staticmethod
108  def _test_delete_pool(self):
109  driver = self.driver
110  self.base_url = self.TEST_SERVER
111 
112  self.login_testuser(self.TEST_admin_cm)
113  self.login_cm_testuser()
114 
115  driver.get(self.base_url + "/admin_cm/pools/")
116 
117  self.wait_for_text("//table[@id='item-list']/tbody", ["10.10.127.0"])
118 
119  self.menu_click("Address", "10.10.127.0", "Delete")
120 
121  self.wait_for_text("//div[@id='dialog-div']/p", ["Do you want to delete pool"])
122 
123  driver.find_element_by_css_selector("button.ok-button.mid_button").click()
124 
125  self.wait_for_message(["You have successfully deleted pool"])
126 
127  driver.find_element_by_link_text("Logout from CM").click()
128  driver.find_element_by_link_text("Logout").click()
129 
130  def test_1_simple(self):
131  self._test_add_pool(self)
132  self._test_lock_pool()
133  self._test_unlock_pool(self)
134  self._test_delete_pool(self)
135