class ForcePullTest(TestCase): def setUp(self): self.filter = ForcePullFilter() @with_json_fixture("single_full_app.json") def test_app_exists_forcepull_not_checked(self, single_full_app_fixture): original_app = MarathonApp.from_json(single_full_app_fixture) request_app = MarathonApp.from_json(single_full_app_fixture) request_app.container.docker.force_pull_image = False modified_request_app = self.filter.write(user=None, request_app=request_app, app=original_app) self.assertTrue(modified_request_app.container.docker.force_pull_image, True) @with_json_fixture("single_full_app.json") def test_creating_app_forcepull_not_checked(self, single_full_app_fixture): original_app = MarathonApp() request_app = MarathonApp.from_json(single_full_app_fixture) request_app.container.docker.force_pull_image = True modified_request_app = self.filter.write(user=None, request_app=request_app, app=original_app) self.assertTrue(modified_request_app.container.docker.force_pull_image, True) @with_json_fixture("single_full_app.json") def test_empty_request_app(self, single_full_app_fixture): """ Isso acontece quando é um request de restart, por exemplo, onde o body do request é vazio. """ original_app = MarathonApp.from_json(single_full_app_fixture) request_app = MarathonApp() modified_request_app = self.filter.write(user=None, request_app=request_app, app=original_app) self.assertTrue(request_app is modified_request_app)
RequestResource.APPS: "response", RequestResource.GROUPS: "response_group", RequestResource.DEPLOYMENTS: "response_deployment", RequestResource.TASKS: "response_task", RequestResource.QUEUE: "response_queue", } FILTERS_PIPELINE = { FilterType.REQUEST: { OperationType.READ: (), OperationType.WRITE: ( NameSpaceFilter(), TransformJSONFilter(), AddURIFilter(), DefaultScaleFilter(), ForcePullFilter(), TrimRequestFilter(), AddAppNameFilter(), BasicConstraintFilter(), AddOwnerConstraintFilter(), IncompatibleFieldsFilter(), LabelsFilter(), ) }, FilterType.RESPONSE: { OperationType.READ: ( NameSpaceFilter(), TransformJSONFilter(), ), OperationType.WRITE: ( NameSpaceFilter(),
def setUp(self): self.filter = ForcePullFilter()