Skip to content

Instantly share code, notes, and snippets.

@cmheisel
cmheisel / test-settings.py
Created November 21, 2009 21:44
Sample Django test settings
from yourapp.settings.common import *
ROOT_URLCONF = 'yourapp.settings.test.urls'
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = ':memory:'
INSTALLED_APPS += ('django_nose', )
TEST_RUNNER = 'django_nose.run_tests'
@cmheisel
cmheisel / cmhflopsy.py
Created June 8, 2009 14:40 — forked from nathanborror/flopsy.py
Fork of nathanb's flopsy but doesn't require Django SETTINGS
"""
Copyright (c) 2008-2009, Nathan Borror
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
@cmheisel
cmheisel / Basecamp Test Object.py
Created February 8, 2009 23:14
Allows for easier and faster unit testing when using the Basecamp API. For details see: http://heisel.org/blog/2009/02/07/adventures-in-unit-testing-the-basecamp-api/
class TestBasecamp(Basecamp):
"""Subclass of Basecamp which records network transactions.
Transactions are serialized to JSON on disk and used in lieu
of network usage on second and subsequent requests.
Basecamp class found here: http://pypi.python.org/pypi/BasecampWrapper/0.1
"""
def __init__(self, baseURL, username, password):
self.__test_responses = { 'GET': {}, 'POST': {} }
super(TestBasecamp, self).__init__(baseURL, username, password)