Added test to check for getting builds by commit filter
@@ -152,6 +152,21 @@ class APIBuildTests(TestCase):
self.assertEqual(build['commands'][0]['run_time'], 5)
self.assertEqual(build['commands'][0]['description'], 'foo')
+ def test_build_filter_by_commit(self):
+ """
+ Create a build with commit
+ Should return the list of builds according to the
+ commit query params
+ """
+ get(Build, project_id=1, version_id=1, builder='foo', commit='test')
+ client = APIClient()
+ api_user = get(User, staff=False, password='test')
+ client.force_authenticate(user=api_user)
+ resp = client.get('/api/v2/build/', {'commit': 'test'}, format='json')
+ self.assertEqual(resp.status_code, 200)
+ build = resp.data
+ self.assertEqual(len(build['results']), 1)
+
class APITests(TestCase):
fixtures = ['eric.json', 'test_data.json']
