|
23 | 23 | @requests_mock.Mocker(real_http=True, adapter=adapter) |
24 | 24 | @mock.patch('api.models.release.publish_release', lambda *args: None) |
25 | 25 | @mock.patch('api.models.release.docker_get_port', mock_port) |
26 | | -@mock.patch('api.models.release.docker_check_access', lambda *args: None) |
27 | 26 | class BuildTest(DryccTransactionTestCase): |
28 | 27 |
|
29 | 28 | """Tests build notification from build system""" |
@@ -603,44 +602,6 @@ def test_build_image_in_registry_with_auth(self, mock_requests): |
603 | 602 | response = self.client.post(url, body) |
604 | 603 | self.assertEqual(response.status_code, 201, response.data) |
605 | 604 |
|
606 | | - def test_build_image_no_registry_password(self, mock_requests): |
607 | | - """build with image from private registry, but no password given""" |
608 | | - app_id = self.create_app() |
609 | | - |
610 | | - # post an image as a build |
611 | | - with mock.patch('api.models.release.docker_check_access') as mock_check_access: |
612 | | - mock_check_access.side_effect = Exception('no no no') # let the image access fail |
613 | | - url = "/v2/apps/{app_id}/builds".format(**locals()) |
614 | | - image = 'autotest/example' |
615 | | - response = self.client.post(url, {'image': image, 'stack': 'container'}) |
616 | | - self.assertEqual(response.status_code, 400, response.data) |
617 | | - |
618 | | - def test_build_image_wrong_registry_password(self, mock_requests): |
619 | | - """build with image from private registry, but wrong password given""" |
620 | | - app_id = self.create_app() |
621 | | - |
622 | | - # post an image as a build using registry hostname |
623 | | - url = "/v2/apps/{app_id}/builds".format(**locals()) |
624 | | - image = 'autotest/example' |
625 | | - response = self.client.post(url, {'image': image, 'stack': 'container'}) |
626 | | - self.assertEqual(response.status_code, 201, response.data) |
627 | | - |
628 | | - # add the required PORT information |
629 | | - url = '/v2/apps/{app_id}/config'.format(**locals()) |
630 | | - body = {'values': json.dumps({'PORT': '80'})} |
631 | | - response = self.client.post(url, body) |
632 | | - self.assertEqual(response.status_code, 201, response.data) |
633 | | - |
634 | | - # set some registry information |
635 | | - with mock.patch('api.models.release.docker_check_access') as mock_check_access: |
636 | | - mock_check_access.side_effect = Exception('no no no') # let the image access fail |
637 | | - url = '/v2/apps/{app_id}/config'.format(**locals()) |
638 | | - body = {'registry': json.dumps({'username': 'bob', 'password': 'zoomzoom'})} |
639 | | - response = self.client.post(url, body) |
640 | | - self.assertEqual(response.status_code, 400, response.data) |
641 | | - mock_check_access.assert_called_with( |
642 | | - image, {'username': 'bob', 'password': 'zoomzoom', 'email': 'autotest@drycc.cc'}) |
643 | | - |
644 | 605 | def test_build_image_in_registry_with_auth_no_port(self, mock_requests): |
645 | 606 | """add authentication to the build but with no PORT config""" |
646 | 607 | app_id = self.create_app() |
|
0 commit comments