It's simple way to mock your back-end from webdriver UI tests
Project description
Bemo(back-end mock) - it’s simple way to mock your back-end from webdriver UI tests.
Installation
Install bemo using pip:
$ pip install bemo
…or install bemo running command below if use want to use Python 2.7:
$ pip install bemo[py2x]
Enjoy!
Usage
from selenium import webdriver
from selene.conditions import text
from selene.tools import set_driver, visit, s
import bemo
wd = webdriver.Firefox()
set_driver(wd)
visit('https://accounts.google.com/SignUp')
with bemo.Session(wd=wd) as session:
handler = session.handle('InputValidator', body={
'input01': {
'Valid': 'false',
'ErrorMessage': 'Error!',
'Errors': {
'GmailAddress': 'It work.',
},
'ErrorData': [],
},
'Locale': 'ru',
})
session.inject()
s('#GmailAddress').set('John Snow')
s('#submitbutton').click()
s('#errormsg_0_GmailAddress').should_have(text('It work.'))
handler.assert_called_once_with({
'method': 'POST',
'url': 'InputValidator?resource=SignUp',
})
Testing
Just run tox to test package.
License
bemo is licensed under the MIT license. See the license file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bemo-0.0.1.tar.gz
(6.6 kB
view details)
File details
Details for the file bemo-0.0.1.tar.gz.
File metadata
- Download URL: bemo-0.0.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af0a8ddd32e3b0622593e097c7b37ba4b5ed0c178162f4d718f7c6cdbb75cec5
|
|
| MD5 |
d19e3c396ba1c3f86fee0f7e791b12da
|
|
| BLAKE2b-256 |
6aba6b36e5b00ef320f4b868a93418e2aa085c0752d0e5f66759f5e8bbc0656b
|