Skip to content

Instantly share code, notes, and snippets.

@davidemoro
davidemoro / echo_ws.sh
Created February 12, 2019 22:51
websocketd test with pytest-play using YAML files
#!/bin/bash
while read line
do
echo "$line"
done
@davidemoro
davidemoro / .travis.yml
Created February 12, 2019 07:34
Travis cassandra service setup
sudo: required
services:
- cassandra
before_script:
- bash travis/setup_cassandra.sh
script:
- ... run test
@davidemoro
davidemoro / .travis.yml
Created February 9, 2019 22:29
docker push travis
sudo: required
services:
- docker
- ...
env:
global:
- IMAGE_NAME=davidemoro/pytest-play
- secure: ...
before_script:
- ...
test_data:
- category: dev
- category: movie
- category: food
---
- type: GET
provider: play_requests
url: https://api.chucknorris.io/jokes/categories
expression: "'dev' in response.json()"
@davidemoro
davidemoro / agenda
Created January 17, 2018 09:13
Python for testing
Talk abstract:
* https://www.pycon.it/conference/talks/python-for-testing
Talk agenda
===========
* why Python and not Java or Javascript
* how to introduce smoothly Python for testing
* create an internal Python learning community
* the importance of cookiecutter scaffolding tools
@davidemoro
davidemoro / zalenium-browserstack-daemon.txt
Created September 7, 2017 10:52
zalenium docker dies with browserstack and daemon mode
Start zalenium with browserstack enabled in daemon mode
=======================================================
davide@davide-VirtualBox:~/workspaces/pcm2_qa$ docker run --rm -d --name zalenium -p 4444:4444 -e BROWSER_STACK_USER -e BROWSER_STACK_KEY -v /tmp/videos:/home/seluser/videos -v /var/run/docker.sock:/var/run/docker.sock --privileged dosel/zalenium start --browserStackEnabled true
Follow logs (ends unexpectedly)
===============================
davide@davide-VirtualBox:~/workspaces/pcm2_qa$ docker logs --follow 37e
...
POST /my_index/_search
{
"query" : {
"filtered": {
"query": {
"query_string": {
"query": "public"
}
},
"filter": {
@davidemoro
davidemoro / py-googlemaps
Created May 10, 2013 08:22
This is a simple patch for py-googlemaps (sourceforge.net/projects/py-googlemaps/). It's incomplete but just it works with the Google Maps API v3 if you have to patch an old existing application that uses the address_to_latlng method.
# v3 api
from googlemaps import GoogleMaps
from googlemaps import GoogleMapsError
from googlemaps import fetch_json
GoogleMaps._GEOCODE_QUERY_URL = 'http://maps.googleapis.com/maps/api/geocode/json?'
def geocode(self, query, sensor='false', oe='utf8', ll='', spn='', gl=''):
if (ll is None and spn is not None) or (ll is not None and spn is None):
raise GoogleMapsError('Both ll and spn must be provided.')