Пример #1
0
    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
    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()