示例#1
0
文件: tests.py 项目: kriben/Hotstreak
    def test_post_a_new_entry(self):
        task = Task(user = self.user, title = "title", description = "description")
        task.save()

        post_data = { "task": "/api/v1/task/1/", "date": "2009-11-22" }
        auth_data = get_auth_dict(self.user)
        response = self.client.post(self.create_post_url(self.entry_url, auth_data), json.dumps(post_data), content_type="application/json") 
        self.assertEqual(response.status_code, 201)
示例#2
0
文件: tests.py 项目: kriben/Hotstreak
 def create_task_for_user(self, user, title, description):
     task = Task(user = user, title = title, description = description)
     task.save()
     return task