def hogetest_create(self): """Tests that valid data is saved to the database, that the response redirects to the view() action that a flash message is set in the session""" response = self.app.post( url = url_for(controller = 'phone', action = 'create'), params = {'mobile_number': u'Created', 'name': u'Created', 'address': u'Created', 'home_number': u'Created', 'dob': u'2000/01/01'}, ) mc = memcache.Client([config['app_conf']['memcachedb.servers']], debug = 0) ser = mc.get('2') u = Unpickler() c = u.restore(ser) assert c.__class__.__name__ == 'Phone' assert c.mobile_number == u'Created' assert c.name == u'Created' assert c.address == u'Created' assert c.home_number == u'Created' assert c.dob == u'2000/01/01' assert urlparse(response.response.location).path == url_for( controller = 'phone', action = 'view', id = '2') assert response.status_int == 302
class TaskTests(TestCase): def setUp(self): self.task = Task() self.pickler = Pickler() self.unpickler = Unpickler() def test_get_json_representation(self): """Get the json representation for the __dict__ object of the Task object...""" task_dict = self.task.__dict__() json_dict = self.unpickler.restore(self.task.to_json()) self.assertEquals(json_dict, task_dict)
def setUp(self): self.task = Task() self.pickler = Pickler() self.unpickler = Unpickler()