This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from robot.libraries.OperatingSystem import OperatingSystem | |
from robot.libraries.BuiltIn import BuiltIn | |
class CommonLibrary(object): | |
''' Common keywords that can be used by any test case''' | |
def __init__(self): | |
self.oslib = OperatingSystem() | |
self.builtin = BuiltIn() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job = Job.fetch(job_id) | |
job.my_attr = ['one', 'two'] | |
job.save() | |
# re-fetch job | |
job = Job.fetch(job_id) | |
print type(job.my_attr) | |
<type 'str'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import unittest | |
import StringIO | |
class DumbestTest(unittest.TestCase): | |
def test_dumber(self): | |
self.assertEqual(True, True) | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
'end_time': '2012-05-07T07: 00: 00+0000', | |
'value': 79 | |
}, | |
{ | |
'end_time': '2012-05-08T07: 00: 00+0000', | |
'value': 121 | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
class MyOwnKeywords(object): | |
def run_cmd(self, cmd): | |
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
output = p.communicate()[0] | |
if p.wait() != 0: | |
print "*WARN* %s failed" %cmd | |
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32com, win32com.client | |
import HTMLParser | |
class MLStripper(HTMLParser.HTMLParser): | |
def __init__(self): | |
self.reset() | |
self.fed = [] | |
def handle_data(self, d): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httplib2 | |
import json | |
h = httplib2.Http() | |
h.add_credentials('user1', 'user1') | |
json_str = json.dumps({'name':"joe blows"}) | |
response, content = h.request("http://example.com/rest", method="POST", body=json_str, headers={'content-type':'application/json'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if tweets %} | |
<div class='latest' style='display:none;'> | |
{% for tweet in tweets %} | |
<div> | |
<h1><a href="http://twitter.com/{{ tweet.username }}/status/{{ tweet.id }}" class="more">{{ tweet.username }}</a> </h1> | |
<div class="entry"> | |
<p> | |
<img align='left' height=45 width=48 src="{{ tweet.profile_image_url }}"></img> | |
<span> {{ tweet.text }}</span> | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Queshuns</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
function refreshTweets() { | |
$.getJSON('/latest', {since: window.latestTweet, nt:(new Date()).getTime()}, | |
function(data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import os | |
import cherrypy | |
import jinja2 | |
from filter_daemon import * | |
try: | |
import json |