-
Recent Posts
Recent Comments
Philip on Running Eclipse MAT on ma… Sandeep D on Running Eclipse MAT on ma… Joe Rybicki on Paste as plain text with … bl4ckb1rd on Adding a session to a Django r… Rag on Copying the config from a Cisc… Archives
Monthly Archives: January 2013
Lead astray by the symptom
I was instantiating a Django subclass in a test, and it wasn’t setting one of the foreign key fields. We are subclassing an Order class, and was doing: OurOrder.objects.create(other=other) When I retrieved the object from the database later, it wasn’t … Continue reading
Posted in django
Leave a comment
Adding a session to a Django request generated by RequestFactory
The Django RequestFactory is a useful tool for writing unit tests against Django views. I was using it to test some code that interacts with Cartridge, and ran into trouble because the RequestFactory doesn’t annotate request objects with Session objects, which … Continue reading
Out of phase
Working on an automated integration test to check that I’ve fixed a bug that manifests itself with new user accounts. When a new account is created, the user has to click on a link they receive via email in order to … Continue reading
Posted in Uncategorized
Leave a comment
Check if there’s unread email in a gmail account
I needed an easy way to check if there’s unread email in a gmail account. import lxml.etree import requests def check_for_new_mail(user, password): “””Check a gmail atom feed for new email””” response = requests.get(‘https://mail.google.com/mail/feed/atom’, auth=(user, password)) ns = {“feed”: “http://purl.org/atom/ns#”} xml … Continue reading
Posted in Uncategorized
Leave a comment