def test_update(self): cluster_id = "unit_test_cluster" cluster1 = Cluster(cluster_id=cluster_id, cdses=[]) cluster1.save(force_insert=True) cluster1.reload() self.assertEquals(len(cluster1["cdses"]), 0) data = {"cluster_id": cluster_id, "cdses": ["unit_test_cds_1"]} json_data = json.dumps(data) resp = self.app.put("/cluster/%s/" % (cluster_id), data=json_data, content_type='application/json') self.assertEquals(resp.status_code, 200) # Using json_util.loads so it can parse the {"$date":value} formats for created_at/updated_at cluster_updated = json_util.loads(resp.data) self.assertEquals(cluster_updated["cdses"], ['unit_test_cds_1'])