cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
registration_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.registration_test
23 #
24 # @author Piotr Wójcik
25 # @author Krzysztof Danielowski
26 # @date 11.10.2012
27 #
28 
29 from wi.tests import WiTestCase
30 import unittest
31 import random
32 
33 
34 class RegistrationTests(WiTestCase, unittest.TestCase):
35 
36  def _fill_common_data(self, field_key=None, field_value=None):
37  driver = self.driver
38  self.base_url = self.TEST_SERVER
39 
40  driver.get(self.base_url + "/registration/register/")
41 
42  self.change_language()
43 
44  self.wait_for_text("//div[@id='content']/div[2]/div/div[5]/h2", ["Registration"])
45 
46  driver.find_element_by_id("id_login").clear()
47  driver.find_element_by_id("id_login").send_keys("witest" + str(random.randint(1, 100000)))
48  driver.find_element_by_id("id_first").clear()
49  driver.find_element_by_id("id_first").send_keys("test")
50  driver.find_element_by_id("id_last").clear()
51  driver.find_element_by_id("id_last").send_keys("test")
52  driver.find_element_by_id("id_organization").clear()
53  driver.find_element_by_id("id_organization").send_keys("test")
54  driver.find_element_by_id("id_email").clear()
55  driver.find_element_by_id("id_email").send_keys("witest" + str(random.randint(1, 100000)) + "@witest.pl")
56  driver.find_element_by_id("id_new_password").clear()
57  driver.find_element_by_id("id_new_password").send_keys("test1")
58  driver.find_element_by_id("id_password2").clear()
59  driver.find_element_by_id("id_password2").send_keys("test1")
60 
61  if field_key is not None:
62  driver.find_element_by_id(field_key).clear()
63  driver.find_element_by_id(field_key).send_keys(field_value)
64 
65  driver.find_element_by_css_selector("input.big_button").click()
66 
67  @unittest.skip('a')
69  driver = self.driver
70  self._fill_common_data()
71  self.assertEqual("Registration success - Registration - CC1", driver.title)
72 
74  self._fill_common_data("id_login", self.TEST_USER['login'])
75  self.wait_for_text("//form[@id='registration-form']/fieldset/div/ul/li", ["A user with that login already exists."])
76 
78  self._fill_common_data("id_email", "witest" + str(random.randint(1, 100000)) + "@witestpl")
79  self.wait_for_text("//form[@id='registration-form']/fieldset/div/ul/li", ["Enter a valid email address."])
80