예제 #1
0
파일: api_test.py 프로젝트: cs181f/rosie
    def test_api_builds(self):
        """ Verifies that a good build builds without error """

        response = self.client.post(
           '/build',
            data=self.json,
            content_type='application/json'
        )

        api.worker.join()

        build = Build.find_one(dict(_id=ObjectId(response.json['id'])))

        self.assertEqual(build['status'],1)
예제 #2
0
파일: api_test.py 프로젝트: cs181f/rosie
    def test_api_builds_bad(self, mock):
        """ Verifies that a bad build returns an error and posts the error to
        GitHub """

        mock.return_value = "This is an error"

        response = self.client.post(
            '/build',
            data=self.json,
            content_type='application/json'
        )

        api.worker.join()

        build = Build.find_one(dict(_id=ObjectId(response.json['id'])))

        self.assertEqual(build.status ,2)
        mock.assert_called_once()