Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View datakurre's full-sized avatar

Asko Soukka datakurre

View GitHub Profile
@datakurre
datakurre / test_zombie.py
Created October 11, 2011 17:09
plone.app.testing javascripts with coffee-script-doctests using zombie.js
import doctest
import subprocess
from plone.app.testing import TEST_USER_NAME, TEST_USER_PASSWORD
def browser(url, debug=False):
def decorator(func):
def wrapper(*args):
parser = doctest.DocTestParser()
@datakurre
datakurre / login.txt
Created August 12, 2012 13:02 — forked from optilude/login.txt
Using robotframework with Plone
*** Settings ***
Documentation A test suite with a single test for valid login. This test has
... a workflow that is created using keywords from the resource file.
Resource resource.txt
*** Test Cases ***
Valid Login
import socket
# Sauce only tunnels certain ports, so we need to pick one of those ports and it should be
# not used.
# See port list at: https://saucelabs.com/docs/connect#localhost
PORTS = [2000, 2001, 2020, 2222, 3000, 3001, 3030, 3333, 4000, 4001, 4040, 5000, 5001, 5050, 5555, 6000, 6001, 6060, 6666, 7000, 7070, 7777, 8000, 8001, 8080, 8888, 9000, 9001, 9080, 9090, 9999, 4502, 4503, 8003, 8031]
def get_free_port():
for port in PORTS:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
*** Settings ***
Library Selenium2Library
Library String
Suite Setup Open browser about: ff_profile_dir=${CURDIR}/profile
Suite Teardown Close all browsers
*** Test Cases ***
[buildout]
extends = http://dist.plone.org/release/4.3-latest/versions.cfg
parts = test
[test]
recipe = zc.recipe.testrunner
eggs =
Pillow
plone.app.robotframework[speak]
@datakurre
datakurre / buildout.cfg
Last active December 25, 2015 00:29
Minimal p.a.robotframework configuration for capturing @@widgets-demo
[buildout]
extends = http://dist.plone.org/release/4.3-latest/versions.cfg
parts = robot
versions = versions
[robot]
recipe = zc.recipe.egg
eggs =
plone.app.widgets
plone.app.robotframework
@datakurre
datakurre / SauceLabs.py
Last active April 3, 2020 13:50
Robot Framework Selenium test suite with Sauce Labs support
import re
import requests
import simplejson as json
from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn
USERNAME_ACCESS_KEY = re.compile('^(http|https):\/\/([^:]+):([^@]+)@')
@datakurre
datakurre / slow_ok.py
Created May 4, 2014 05:37
Asynchronous ZPublisher stream iterator
import StringIO
import threading
from zope.interface import implements
from ZPublisher.Iterators import IStreamIterator
from ZServer.PubCore.ZEvent import Wakeup
from zope.globalrequest import getRequest
@datakurre
datakurre / datakurre-nix-exec.nix
Last active August 29, 2015 14:06
Opinionated cli wrapper for nix expressions
###
# Simple 'nix-exec' shebang wrapper for using nix-expression as 'standalone'
# execs (outside NixOS, e.g. on OSX) without installing them with 'nix-env'.
#
# The original use case was to replace Python virtualenvs with nix expressions
# in Python development.
#
# Install:
#
# $ nix-env -i -f datakurre-nix-exec.nix
@datakurre
datakurre / workflow.py
Last active August 29, 2015 14:17
Example workflow for pyramid_workflow
# -*- coding: utf-8 -*-
from pyramid_workflow import (
Workflow,
get_workflow
)
def incoming_start(context, request, transition, workflow):
pass