+# -*- coding: utf-8 -*-\r
+#\r
+# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later.\r
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.\r
+#\r
import os\r
import inspect\r
-from urlparse import urlparse\r
\r
from django.test import LiveServerTestCase\r
from django.test.client import Client\r
from django.conf import settings\r
-from django.contrib.auth.models import User, Permission\r
+from django.contrib.auth.models import User\r
from django.utils.translation import ugettext as _\r
\r
-from selenium import webdriver, selenium\r
-from selenium.webdriver.support.wait import WebDriverWait\r
+from selenium import webdriver\r
\r
\r
class SeleniumTestCase(LiveServerTestCase):\r
def setUp(self):\r
self.browser.delete_all_cookies()\r
\r
- def create_user(self, username = 'testuser', passwd = 'passwd', do_login = False):\r
+ def create_user(self, username='testuser', passwd='passwd', do_login=False):\r
user = User.objects.create_user(username, '', passwd)\r
user._plain_passwd = passwd\r
if do_login:\r
\r
def login_user(self, user):\r
client = Client()\r
- client.login(username = user.username, password = user._plain_passwd)\r
+ client.login(username=user.username, password=user._plain_passwd)\r
\r
if not self.browser.current_url.startswith(self.live_server_url):\r
self.browser.get(self.live_server_url+'/not_existing_url')\r
\r
- self.browser.find_element_by_tag_name('body') # Make sure the page is actually loaded before setting the cookie\r
+ self.browser.find_element_by_tag_name('body') # Make sure the page is actually loaded before setting the cookie\r
self.browser.delete_cookie(settings.SESSION_COOKIE_NAME)\r
- self.browser.add_cookie(dict(name = settings.SESSION_COOKIE_NAME, \r
- value = client.cookies[settings.SESSION_COOKIE_NAME].value,\r
- path = '/')\r
- )\r
+ self.browser.add_cookie(dict(name=settings.SESSION_COOKIE_NAME,\r
+ value=client.cookies[settings.SESSION_COOKIE_NAME].value,\r
+ path='/'))\r
\r
def get_main_page(self):\r
self.browser.get(self.live_server_url)\r
a.click()\r
self.tab = find_tab_class(tab_title)(self.browser)\r
return\r
- raise Exception, 'Tab not found'\r
+ raise Exception('Tab not found')\r
\r
\r
def find_tab_class(tab_title): \r
@property\r
def visible_books_count(self):\r
return len(self.element.find_element_by_id('file-list').find_elements_by_tag_name('tr')) - 2\r
- \r
-
\ No newline at end of file