Browse Source

fix webdriver tests

* introduce PhantomJS (headless webkit) (also a new dependency)
* better docstrings
* webdriver tests get their own config file (.ini) and database (.db)
feature/1967/afm_pdflatex
Christoph Scheid 6 years ago
parent
commit
f779d11552
4 changed files with 516 additions and 73 deletions
  1. +381
    -71
      c3smembership/tests/test_views_webdriver.py
  2. +110
    -0
      c3smembership/tests/webdriver_utils.py
  3. +3
    -2
      development.ini
  4. +22
    -0
      webdrivertest.ini

+ 381
- 71
c3smembership/tests/test_views_webdriver.py View File

@ -1,57 +1,156 @@
# _*_ coding: utf-8 _*_
import unittest
"""
These tests test
* the join form and
* the email verification form
using selenium/webdriver (make a browser do things), see:
* http://docs.seleniumhq.org/docs/03_webdriver.jsp#introducing-the-selenium-webdriver-api-by-example
* http://selenium-python.readthedocs.org/en/latest/api.html
* http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html
On the machine where these tests run, a virtual screen (X) must be running,
e.g. Xvfb, so the browser can start and things be done,
even in headless mode, e.g. on a virtual machine on a remote server
with no real screen attached.
While developing these tests, it comes in handy to have Xephyr installed,
a nested X server, so you see what is going on:
selenium/webdriver makes the browser do things.
"""
import os
# from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# from selenium.webdriver.support.ui import WebDriverWait
# available since 2.4.0
# from selenium.webdriver.support import expected_conditions as EC
# available since 2.26.0
import time
from subprocess import call
import time
import unittest
from webdriver_utils import (
Server,
Client
)
# maybe check https://pypi.python.org/pypi/z3c.webdriver
"""
this setting controls whether the browser will be visible (1) or not (0)
"""
is_visible = 1
# configuration of testing framework
cfg = {
'app': {
'host': '0.0.0.0',
'port': '6543',
'db': 'webdrivertest.db',
'ini': "webdrivertest.ini",
'appSettings': {},
},
}
server = Server()
client = Client()
class SeleniumTestBase(unittest.TestCase):
# overload: configuration of individual appSettings
@classmethod
def appSettings(self):
return {}
def initialize_db(self):
"""
make sure we have entries in the DB
"""
if os.path.isfile('webdrivertest.db'):
call(['rm', 'webdrivertest.db'])
print("old database was deleted.")
print("initialize the test database:")
call(['env/bin/initialize_c3sMembership_db', 'webdrivertest.ini'])
print("database was set up.")
def setUp(self):
# stop the daemon iff running
call(['env/bin/pserve', 'development.ini', 'stop'])
# start the app
call(['env/bin/pserve', 'development.ini', 'start'])
time.sleep(3)
self.driver = webdriver.Firefox() # PhantomJS()
# # daemon start/stop
# # stop the daemon iff running
# call(['env/bin/pserve', 'webdrivertest.ini', 'stop'])
# # start the app
# call(['env/bin/pserve', 'webdrivertest.ini', 'start'])
# wsgi way!
self.cfg = cfg
self.srv = server.connect(
cfg=self.cfg,
customAppSettings=self.appSettings(),
wrapper='StopableWSGIServer'
)
# self.cli = client.connect(
# cfg=self.cfg
# )
time.sleep(0.1)
# self.display = Display(
# visible=is_visible,
# size=(1024, 768)
# # size=(1600, 1200)
# )
# self.display.start()
# self.driver = webdriver.Firefox()
self.driver = webdriver.PhantomJS()
# self.driver = webdriver.Chrome()
# get rid of all cookies
self.driver.delete_all_cookies()
def tearDown(self):
self.driver.close()
self.driver.quit()
# self.display.stop()
# client.disconnect()
server.disconnect()
time.sleep(2)
class JoinFormTests(SeleniumTestBase):
"""
test the join form using selenium (make a browser do things)
see
http://docs.seleniumhq.org/docs/03_webdriver.jsp
#introducing-the-selenium-webdriver-api-by-example
http://selenium-python.readthedocs.org/en/latest/api.html
http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html
Test the join form with selenium/webdriver.
"""
def setUp(self):
super(JoinFormTests, self).setUp()
def tearDown(self):
self.driver.quit()
call(['env/bin/pserve', 'development.ini', 'stop'])
# self.driver.quit()
super(JoinFormTests, self).tearDown()
# call(['env/bin/pserve', 'webdrivertest.ini', 'stop'])
def test_form_submission_de(self):
from c3smembership.views.afm import join_c3s # trigger coverage
join_c3s
self.driver.get("http://0.0.0.0:6543/?de")
"""
A webdriver test for the join form, german version
"""
self.assertEqual(self.driver.get_cookies(), [])
# load the page with the form, choose german
self.driver.get("http://0.0.0.0:6543?de")
# self.driver.maximize_window()
inputElement = self.driver.find_element_by_name("firstname")
inputElement.send_keys("Christoph")
self.driver.get_screenshot_as_file('test_form_submission_de.png')
self.failUnless(
u'Mitgliedschaftsantrag' in self.driver.page_source)
# check for cookie -- should be 'de' for germen
self.assertEquals(self.driver.get_cookie('_LOCALE_')['value'], u'de')
# fill out the form
self.driver.find_element_by_name("firstname").send_keys("Christoph")
self.driver.find_element_by_name('lastname').send_keys('Scheid')
time.sleep(0.1)
self.driver.find_element_by_name('email').send_keys('c@c3s.cc')
time.sleep(0.1)
self.driver.find_element_by_name('password').send_keys('foobar')
time.sleep(0.1)
self.driver.find_element_by_name('password-confirm').send_keys('foobar')
self.driver.find_element_by_name('password-confirm').send_keys(
'foobar')
time.sleep(0.1)
self.driver.find_element_by_name('address1').send_keys('addr one')
time.sleep(0.11)
@ -61,7 +160,7 @@ class JoinFormTests(SeleniumTestBase):
time.sleep(0.1)
self.driver.find_element_by_name('city').send_keys('townish')
time.sleep(0.1)
self.driver.find_element_by_name('country').send_keys('Gro')
self.driver.find_element_by_name('country').send_keys('Gri')
time.sleep(0.1)
self.driver.find_element_by_name('year').send_keys(Keys.CONTROL, "a")
self.driver.find_element_by_name('year').send_keys('1998')
@ -77,8 +176,7 @@ class JoinFormTests(SeleniumTestBase):
self.driver.find_element_by_name('other_colsoc').click() # Yes
# self.driver.find_element_by_id('other_colsoc-1').click() # No
time.sleep(0.1)
self.driver.find_element_by_id(
'colsoc_name').send_keys('GEMA')
self.driver.find_element_by_id('colsoc_name').send_keys('GEMA')
time.sleep(0.1)
self.driver.find_element_by_name('got_statute').click()
time.sleep(0.1)
@ -88,23 +186,184 @@ class JoinFormTests(SeleniumTestBase):
self.driver.find_element_by_name('submit').click()
self.failUnless('E-Mail anfordern' in self.driver.page_source)
self.failUnless(
u'Bestätigungs-E-Mail schicken' in self.driver.page_source)
# TODO: check contents of success page XXX
self.assertTrue('Christoph' in self.driver.page_source)
self.assertTrue('Scheid' in self.driver.page_source)
self.assertTrue('Was nun passieren muss: Kontrolliere die Angaben '
'unten,' in self.driver.page_source)
# TODO: check case colsoc = no views.py 765-767
# TODO: check save to DB/randomstring: views.py 784-865
self.failUnless(u'Daten bearbeiten' in self.driver.page_source)
# back to the form
self.driver.find_element_by_name('edit').click()
time.sleep(1) # wait a little
self.assertEqual(self.driver.find_element_by_name(
'lastname').get_attribute('value'), 'Scheid')
self.assertEqual(self.driver.find_element_by_name(
'firstname').get_attribute('value'), 'Christoph')
self.assertEqual(self.driver.find_element_by_name(
'email').get_attribute('value'), 'c@c3s.cc')
# self.assertEqual(self.driver.find_element_by_name(
# 'password').get_attribute('value'), 'foobar')
# print("the password: %s" % self.driver.find_element_by_name(
# 'password').get_attribute('value'))
self.assertEqual(self.driver.find_element_by_name(
'address1').get_attribute('value'), 'addr one')
self.assertEqual(self.driver.find_element_by_name(
'address2').get_attribute('value'), 'addr two')
self.assertEqual(self.driver.find_element_by_name(
'postcode').get_attribute('value'), '98765')
self.assertEqual(self.driver.find_element_by_name(
'city').get_attribute('value'), 'townish')
self.assertEqual(self.driver.find_element_by_name(
'country').get_attribute('value'), 'GR')
self.assertEqual(self.driver.find_element_by_name(
'year').get_attribute('value'), '1998')
self.assertEqual(self.driver.find_element_by_name(
'month').get_attribute('value'), '12')
self.assertEqual(self.driver.find_element_by_name(
'day').get_attribute('value'), '12')
self.assertEqual(self.driver.find_element_by_name(
'deformField14').get_attribute('value'), 'normal')
self.assertEqual(self.driver.find_element_by_name(
'other_colsoc').get_attribute('value'), 'yes')
self.assertEqual(self.driver.find_element_by_id(
'colsoc_name').get_attribute('value'), 'GEMA')
self.assertEqual(self.driver.find_element_by_name(
'num_shares').get_attribute('value'), '17')
# change a detail
self.driver.find_element_by_name('address2').send_keys(' plus')
# ok, all data checked, submit again
self.driver.find_element_by_name('submit').click()
self.assertTrue('Bitte beachten: Es gab Fehler. Bitte Eingaben unten '
'korrigieren.' in self.driver.page_source)
# verify we have to theck this again
self.driver.find_element_by_name('got_statute').click()
self.driver.find_element_by_name('got_dues_regulations').click()
self.driver.find_element_by_id('other_colsoc-1').click() # No colsoc
self.driver.find_element_by_id('colsoc_name').send_keys(Keys.CONTROL, "a")
self.driver.find_element_by_id('colsoc_name').send_keys(Keys.DELETE)
# enter password
self.driver.find_element_by_name('password').send_keys('foobar')
self.driver.find_element_by_name('password-confirm').send_keys(
'foobar')
time.sleep(0.1)
self.driver.find_element_by_name('submit').click()
time.sleep(0.1)
self.assertTrue(
'Bitte beachten: Es gab fehler' not in self.driver.page_source)
self.assertTrue('addr two plus' in self.driver.page_source)
# print self.driver.page_source
# time.sleep(10)
self.driver.find_element_by_name('send_email').click()
time.sleep(0.1)
page = self.driver.page_source
self.assertTrue('C3S Mitgliedsantrag: Bitte E-Mails abrufen.' in page)
self.assertTrue('Eine E-Mail wurde verschickt,' in page)
self.assertTrue('Christoph Scheid!' in page)
self.assertTrue(
u'Du wirst eine E-Mail von noreply@c3s.cc mit einem ' in page)
self.assertTrue(
u'Bestätigungslink erhalten. Bitte rufe Deine E-Mails ab.' in page)
self.assertTrue(u'Der Betreff der E-Mail lautet:' in page)
self.assertTrue(u'C3S: E-Mail-Adresse' in page)
self.assertTrue(u'tigen und Formular abrufen' in page)
def test_form_submission_en(self):
"""
A webdriver test for the join form, english version
"""
self.assertEqual(self.driver.get_cookies(), [])
# load the page with the form
self.driver.get("http://0.0.0.0:6543?en")
# self.driver.maximize_window()
self.driver.get_screenshot_as_file('test_form_submission_en.png')
self.failUnless( # english !?!
u'Application for Membership' in self.driver.page_source)
# check for cookie -- should be 'en' for english
self.assertEquals(self.driver.get_cookie('_LOCALE_')['value'], u'en')
# fill out the form
self.driver.find_element_by_name("firstname").send_keys("Christoph")
self.driver.find_element_by_name('lastname').send_keys('Scheid')
time.sleep(0.1)
self.driver.find_element_by_name('email').send_keys('c@c3s.cc')
time.sleep(0.1)
self.driver.find_element_by_name('password').send_keys('foobar')
time.sleep(0.1)
self.driver.find_element_by_name('password-confirm').send_keys(
'foobar')
time.sleep(0.1)
self.driver.find_element_by_name('address1').send_keys('addr one')
time.sleep(0.11)
self.driver.find_element_by_name('address2').send_keys('addr two')
time.sleep(0.11)
self.driver.find_element_by_name('postcode').send_keys('98765')
time.sleep(0.1)
self.driver.find_element_by_name('city').send_keys('townish')
time.sleep(0.1)
self.driver.find_element_by_name('country').send_keys('Gro')
time.sleep(0.1)
self.driver.find_element_by_name('year').send_keys(Keys.CONTROL, "a")
self.driver.find_element_by_name('year').send_keys('1998')
time.sleep(0.1)
self.driver.find_element_by_name('month').send_keys(Keys.CONTROL, "a")
self.driver.find_element_by_name('month').send_keys('12')
time.sleep(0.1)
self.driver.find_element_by_name('day').send_keys(Keys.CONTROL, "a")
self.driver.find_element_by_name('day').send_keys('12')
time.sleep(0.1)
self.driver.find_element_by_name('deformField14').click()
time.sleep(0.1)
self.driver.find_element_by_name('other_colsoc').click() # Yes
# self.driver.find_element_by_id('other_colsoc-1').click() # No
time.sleep(0.1)
self.driver.find_element_by_id('colsoc_name').send_keys('GEMA')
time.sleep(0.1)
self.driver.find_element_by_name('got_statute').click()
time.sleep(0.1)
self.driver.find_element_by_name('got_dues_regulations').click()
time.sleep(0.1)
self.driver.find_element_by_name('num_shares').send_keys('7')
self.driver.find_element_by_name('submit').click()
# self.failUnless('E-Mail anfordern' in self.driver.page_source)
self.failUnless('Send verification email' in self.driver.page_source)
# TODO: check contents of success page XXX
self.assertTrue('Christoph' in self.driver.page_source)
self.assertTrue('Scheid' in self.driver.page_source)
self.assertTrue('What happens next: You need to check the information '
'below to be correct, receive an email to verify your '
'address,' in self.driver.page_source)
# TODO: check case colsoc = no views.py 765-767
# TODO: check save to DB/randomstring: views.py 784-865
# TODO: check re-edit of form: views.py 877-880 XXX
# self.failUnless('Angaben ändern' in self.driver.page_source)
self.driver.find_element_by_name('edit').click()
# back to the form
time.sleep(0.1) # wait a little
time.sleep(1) # wait a little
self.assertEqual(self.driver.find_element_by_name(
'lastname').get_attribute('value'), 'Scheid')
self.assertEqual(self.driver.find_element_by_name(
@ -124,7 +383,7 @@ class JoinFormTests(SeleniumTestBase):
self.assertEqual(self.driver.find_element_by_name(
'city').get_attribute('value'), 'townish')
self.assertEqual(self.driver.find_element_by_name(
'country').get_attribute('value'), 'GB')
'country').get_attribute('value'), 'GR')
self.assertEqual(self.driver.find_element_by_name(
'year').get_attribute('value'), '1998')
self.assertEqual(self.driver.find_element_by_name(
@ -144,16 +403,18 @@ class JoinFormTests(SeleniumTestBase):
# ok, all data checked, submit again
self.driver.find_element_by_name('submit').click()
self.assertTrue('Bitte beachten: Es gab Fehler. Bitte Eingaben unten '
'korrigieren.' in self.driver.page_source)
self.assertTrue('Please note: There were errors, please check the '
'form below.' in self.driver.page_source)
# verify we have to theck this again
self.driver.find_element_by_name('got_statute').click()
self.driver.find_element_by_name('got_dues_regulations').click()
self.driver.find_element_by_id('other_colsoc-1').click() # No colsoc
self.driver.find_element_by_id('colsoc_name').send_keys('')
# enter password
self.driver.find_element_by_name('password').send_keys('foobar')
self.driver.find_element_by_name('password-confirm').send_keys('foobar')
self.driver.find_element_by_name('password-confirm').send_keys(
'foobar')
time.sleep(0.1)
self.driver.find_element_by_name('submit').click()
@ -169,37 +430,65 @@ class JoinFormTests(SeleniumTestBase):
page = self.driver.page_source
self.assertTrue('C3S Mitgliedsantrag: Bitte Emails abrufen.' in page)
self.assertTrue('Eine Email wurde verschickt,' in page)
# self.assertTrue('C3S Mitgliedsantrag: Bitte Emails abrufen.' in page)
self.assertTrue('C3S Membership Application: Check your email' in page)
# self.assertTrue('Eine Email wurde verschickt,' in page)
self.assertTrue('An email was sent,' in page)
self.assertTrue('Christoph Scheid!' in page)
# self.assertTrue(
# u'Du wirst eine Email von noreply@c3s.cc mit einem ' in page)
# self.assertTrue(
# u'Bestätigungslink erhalten. Bitte rufe Deine Emails ab.' in page)
self.assertTrue(
u'Du wirst eine Email von noreply@c3s.cc mit einem ' in page)
u'You will receive an email from noreply@c3s.cc with ' in page)
self.assertTrue(
u'Bestätigungslink erhalten. Bitte rufe Deine Emails ab.' in page)
u'a link. Please check your email!' in page)
self.assertTrue(u'Der Betreff der Email lautet:' in page)
self.assertTrue(u'C3S: Email-Adresse' in page)
# self.assertTrue(u'Der Betreff der Email lautet:' in page)
self.assertTrue(u'The email subject line will read:' in page)
# self.assertTrue(u'C3S: Email-Adresse' in page)
self.assertTrue(u'C3S: confirm your email address ' in page)
# self.assertTrue(u'tigen und Formular abrufen.' in page)
self.assertTrue(u'and load your PDF' in page)
time.sleep(0.1)
class EmailVerificationTests(SeleniumTestBase):
"""
Tests for the view where users are sent after submitting their data.
They must enter their password and thereby confirm their email address,
as they got to this form by clicking on a link supplied by mail.
"""
def setUp(self):
super(EmailVerificationTests, self).initialize_db()
super(EmailVerificationTests, self).setUp()
def tearDown(self):
self.driver.quit()
call(['env/bin/pserve', 'development.ini', 'stop'])
def test_verify_email(self): # views.py 296-298
url = "http://0.0.0.0:6543/verify/foo@shri.de/ABCDEFGHIJ"
# self.driver.quit()
super(EmailVerificationTests, self).tearDown()
# call(['env/bin/pserve', 'webdrivertest.ini', 'stop'])
def test_verify_email_de(self): # views.py 296-298
"""
This test checks -- after an application has been filled out --
for the password supplied during application.
If the password matches the email address, a link to a PDF is given.
Thus, an half-ready application must be present in the DB.
"""
url = "http://0.0.0.0:6543/verify/uat.yes@c3s.cc/ABCDEFGHIJ?de"
self.driver.get(url)
# print(self.driver.page_source)
self.assertTrue(
'Bitte das Passwort eingeben.' in self.driver.page_source)
u'Bitte gib Dein Passwort ein, um' in self.driver.page_source)
self.assertTrue(
u'Deine E-Mail-Adresse zu bestätigen.' in self.driver.page_source)
self.assertTrue(
'Hier geht es zum PDF...' in self.driver.page_source)
# try with empty or wrong password -- must fail
self.driver.find_element_by_name(
'password').send_keys('') # empty password
self.driver.find_element_by_name('submit').click()
@ -214,36 +503,57 @@ class EmailVerificationTests(SeleniumTestBase):
self.assertTrue(
'Bitte das Passwort eingeben.' in self.driver.page_source)
self.assertTrue('Hier geht es zum PDF...' in self.driver.page_source)
# try correct password
self.driver.find_element_by_name('password').send_keys('berries')
self.driver.find_element_by_name('submit').click()
self.assertTrue('Lade dein PDF...' in self.driver.page_source)
# print(self.driver.page_source)
self.assertTrue('Lade Dein PDF...' in self.driver.page_source)
self.assertTrue(
'C3S_SCE_AFM_Firstn_meLastname.pdf' in self.driver.page_source)
# XXX TODO: check PDF download
def test_verify_email_en(self): # views.py 296-298
"""
This test checks -- after an application has been filled out --
for the password supplied during application.
If the password matches the email address, a link to a PDF is given.
Thus, an half-ready application must be present in the DB.
"""
url = "http://0.0.0.0:6543/verify/uat.yes@c3s.cc/ABCDEFGHIJ?en"
self.driver.get(url)
# import pdb
# pdb.set_trace()
# def test_verify_email_wrong_pass(self): # views.py 296-298
# pass
# def test_foo(self):
# pass
# print(self.driver.page_source)
# check text on page
self.assertTrue(
'Please enter your password in order ' in self.driver.page_source)
self.assertTrue(
'to verify your email address.' in self.driver.page_source)
# class DashboardPageObject(object):
# def __init__(self):
# pass
# # ToDo: write page object
#
# enter empty or wrong password -- must fail
self.driver.find_element_by_name(
'password').send_keys('') # empty password
self.driver.find_element_by_name('submit').click() # submit
self.assertTrue(
'Please enter your password.' in self.driver.page_source)
self.driver.find_element_by_name(
'password').send_keys('schmoo') # wrong password
self.driver.find_element_by_name('submit').click() # submit
# class OrderByTests(SeleniumTestBase):
# def setUp(self):
# super(OrderByTests, self).setUp()
# self.driver.get('')
self.assertTrue(
'Please enter your password.' in self.driver.page_source)
# def tearDown(self):
# self.driver.quit()
#
# try correct password
self.driver.find_element_by_name('password').send_keys('berries')
self.driver.find_element_by_name('submit').click() # submit
# def test(self):
# url = "http://0.0.0.0:6543/dashboard/0/id/asc"
# print(self.driver.page_source)
self.assertTrue('Load your PDF...' in self.driver.page_source)
self.assertTrue( # PDF form is visible
'C3S_SCE_AFM_Firstn_meLastname.pdf' in self.driver.page_source)
# XXX TODO: check PDF download

+ 110
- 0
c3smembership/tests/webdriver_utils.py View File

@ -0,0 +1,110 @@
"""
This module has some useful stuff for webdriver testing.
"""
import os
from sqlalchemy import engine_from_config
from c3smembership.models import (
DBSession,
Base,
# C3sStaff,
# Group,
)
from paste.deploy.loadwsgi import appconfig
from webtest.http import StopableWSGIServer
from webtest import TestApp
from selenium import webdriver
class Server(object):
# singleton
_instance = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(Server, cls).__new__(cls, *args, **kwargs)
return cls._instance
def connect(self, cfg, customAppSettings={}, wrapper='StopableWSGIServer'):
self.cfg = cfg
# clear old connections
# try:
# DBSession.close()
# DBSession.remove()
# os.remove(self.cfg['app']['db'])
# except:
# pass
# create appConfig from ini
self.appSettings = appconfig(
'config:' + os.path.join(
os.path.dirname(__file__), '../../', self.cfg['app']['ini']
)
)
# store some derived variables
self.appSettings['sqlalchemy.url'] = 'sqlite:///'+self.cfg['app']['db']
# merge/override appConfig with custom settings in cfg
self.appSettings.update(self.cfg['app']['appSettings'])
# merge/override appConfig with individual custom settings
self.appSettings.update(customAppSettings)
# app
engine = engine_from_config(self.appSettings)
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
from c3smembership import main
app = main({}, **self.appSettings)
# create srv
if wrapper == 'StopableWSGIServer':
self.srv = StopableWSGIServer.create(
app,
host=self.cfg['app']['host'],
port=self.cfg['app']['port']
)
# check srv
if not self.srv.wait():
raise Exception('Server could not be fired up. Exiting ...')
elif wrapper == 'TestApp':
self.srv = TestApp(app)
else:
raise Exception('Wrapper could not be found. Exiting ...')
# store some variables
self.srv.db = DBSession
self.srv.url = 'http://' + self.cfg['app']['host'] + ':' \
+ self.cfg['app']['port'] + '/'
# self.srv.lu = 'lu/' + self.cfg['member']['token'] + '/' \
# + self.cfg['member']['email']
return self.srv
def disconnect(self):
self.srv.db.close()
self.srv.db.remove()
os.remove(self.cfg['app']['db'])
if isinstance(self.srv, StopableWSGIServer):
self.srv.shutdown()
def shutdown(self):
# self.srv.db.close()
# self.srv.db.remove()
# os.remove(self.cfg['app']['db'])
if isinstance(self.srv, StopableWSGIServer):
self.srv.shutdown()
class Client(object):
# singleton
_instance = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(Client, cls).__new__(cls, *args, **kwargs)
return cls._instance
def connect(self, cfg):
self.cfg = cfg
# self.cli = webdriver.PhantomJS()
# self.cli = webdriver.Firefox()
self.cli = webdriver.Chromium()
return self.cli
def disconnect(self):
self.cli.quit()

+ 3
- 2
development.ini View File

@ -4,7 +4,7 @@ use = egg:c3sMembership
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_routematch = true
pyramid.debug_templates = true
pyramid.default_locale_name = de
pyramid.includes = pyramid_debugtoolbar
@ -22,7 +22,8 @@ c3smembership.dashboard_number = 30
c3smembership.adminpass = rut
c3smembership.adminlogin = berries
c3smembership.url = http://0.0.0.0:6543
available_languages = de en # da es fr
available_languages = de en
# da es fr
startnext_importfile = /the/path/to/c3sMembership/import/test_startnext.csv
founders_importfile = /path/to/c3sMembership/import/test_founders.csv
api_auth_token = 1234567890ABCDEFGHIJKL


+ 22
- 0
webdrivertest.ini View File

@ -0,0 +1,22 @@
[app:main]
use = egg:c3sMembership
sqlalchemy.url = sqlite:///%(here)s/webdrivertest.db
# settings for c3sMembership
c3smembership.runmode = dev
c3smembership.mailaddr = c@c3s.cc
c3smembership.offset = 15
c3smembership.dashboard_number = 30
c3smembership.adminpass = rut
c3smembership.adminlogin = berries
c3smembership.url = http://0.0.0.0:6543
available_languages = de en
# da es fr
testing.mail_to_console = true
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543

Loading…
Cancel
Save