def setUp(self): self._command = ListUpdates() self._job_key = AuroraJobKey.from_thrift("cluster", UPDATE_KEY.job) self._mock_options = mock_verb_options(self._command) self._mock_options.filter = UpdateFilter( cluster=self.TEST_CLUSTER, role=None, env=None, job=None) self._fake_context = FakeAuroraCommandContext() self._fake_context.set_options(self._mock_options) self._mock_api = self._fake_context.get_api('UNUSED')
def test_list_updates_by_env(self): self._mock_options.filter = UpdateFilter( cluster=self.TEST_CLUSTER, role='role', env='noenv', job=None) self._mock_api.query_job_updates.return_value = get_status_query_response(count=3) assert self._command.execute(self._fake_context) == EXIT_OK assert self._mock_api.query_job_updates.mock_calls == [ call(role="role", user=None, job_key=None, update_statuses=None) ] # None of the returned values matched the env filter, so there is no output. assert self._fake_context.get_out_str() == ''