)]}'
{"id":"openstack%2Fhorizon~777749","triplet_id":"openstack%2Fhorizon~master~I9e37dc1eaa08adf36d11975fed6f5a0a90cdde52","project":"openstack/horizon","branch":"master","topic":"create-mocks","hashtags":[],"change_id":"I9e37dc1eaa08adf36d11975fed6f5a0a90cdde52","subject":"test: Ensure to stop mock when create_mocks decorator exits","status":"MERGED","created":"2021-02-26 13:41:28.000000000","updated":"2021-03-04 21:46:41.000000000","submitted":"2021-03-04 21:45:06.000000000","submitter":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"total_comment_count":0,"unresolved_comment_count":0,"has_review_started":true,"submission_id":"777749-create-mocks","meta_rev_id":"2a89834bc969db8d69992a101610be52cba0b8a0","_number":777749,"virtual_id_number":777749,"owner":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"actions":{},"labels":{"Verified":{"approved":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"all":[{"value":0,"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},{"value":0,"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},{"tag":"autogenerated:zuul:gate","value":2,"date":"2021-03-04 21:45:05.000000000","permitted_voting_range":{"min":2,"max":2},"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Fails","-1":"Doesn\u0027t seem to work"," 0":"No score","+1":"Works for me","+2":"Verified"},"description":"","default_value":0,"optional":true},"Code-Review":{"approved":{"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},"all":[{"value":2,"date":"2021-03-02 12:12:21.000000000","permitted_voting_range":{"min":2,"max":2},"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},{"value":2,"date":"2021-03-04 14:41:03.000000000","permitted_voting_range":{"min":2,"max":2},"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},{"value":0,"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-2":"Do not merge","-1":"This patch needs further work before it can be merged"," 0":"No score","+1":"Looks good to me, but someone else must approve","+2":"Looks good to me (core reviewer)"},"description":"","default_value":0,"optional":true},"Workflow":{"approved":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"all":[{"value":0,"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},{"value":1,"date":"2021-03-04 14:41:03.000000000","permitted_voting_range":{"min":1,"max":1},"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},{"value":0,"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-1":"Work in progress"," 0":"Ready for reviews","+1":"Approved"},"description":"","default_value":0,"optional":true},"Review-Priority":{"all":[{"value":0,"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},{"value":0,"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},{"value":0,"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}],"values":{"-1":"Release Freeze"," 0":"No Priority","+1":"Important Change","+2":"Gate Blocker Fix / Urgent Change"},"description":"","default_value":0,"optional":true}},"removable_reviewers":[],"reviewers":{"REVIEWER":[{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},{"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"}]},"pending_reviewers":{},"reviewer_updates":[{"updated":"2021-02-26 15:09:50.000000000","updated_by":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"reviewer":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"state":"REVIEWER"},{"updated":"2021-03-02 12:12:21.000000000","updated_by":{"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},"reviewer":{"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},"state":"REVIEWER"},{"updated":"2021-03-04 14:41:03.000000000","updated_by":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"reviewer":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"state":"REVIEWER"}],"messages":[{"id":"d4a8be9f9c5e4f108915bbcd704d4ff1cc5bd3ad","tag":"autogenerated:gerrit:newPatchSet","author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"date":"2021-02-26 13:41:28.000000000","message":"Uploaded patch set 1.","accounts_in_message":[],"_revision_number":1},{"id":"b1360a56f37c57c7527f938bb2184f0e032846d7","tag":"autogenerated:zuul:check","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-02-26 15:09:50.000000000","message":"Patch Set 1: Verified+1\n\nBuild succeeded (check pipeline).\n\n- horizon-cross-manila-ui-python https://zuul.opendev.org/t/openstack/build/ea3089109fce4f529ce4aa33aa568240 : SUCCESS in 7m 45s (non-voting)\n- horizon-cross-ironic-ui-npm https://zuul.opendev.org/t/openstack/build/08f6828d5b734627b5677748a73d0bbf : SUCCESS in 8m 41s (non-voting)\n- horizon-cross-heat-dashboard-python https://zuul.opendev.org/t/openstack/build/8ae0f7b984c14bcda61b29501a209403 : SUCCESS in 4m 20s (non-voting)\n- horizon-nodejs10-run-lint https://zuul.opendev.org/t/openstack/build/79d07e85a1734ba58d7a3fa329490652 : SUCCESS in 4m 59s\n- horizon-nodejs10-run-test https://zuul.opendev.org/t/openstack/build/f0c40c874aad4adbbe555e1bf59940e7 : SUCCESS in 8m 52s\n- openstack-tox-py38 https://zuul.opendev.org/t/openstack/build/5903924462a941ea9bfd8423d807e734 : SUCCESS in 9m 03s\n- openstack-tox-lower-constraints https://zuul.opendev.org/t/openstack/build/112aafb83bb946d2882ea46bfb3e26d2 : SUCCESS in 9m 28s\n- openstack-tox-pep8 https://zuul.opendev.org/t/openstack/build/c0f0109432fc4bdcb4bf7aa8d8007a06 : SUCCESS in 5m 27s\n- openstack-tox-py36 https://zuul.opendev.org/t/openstack/build/710bea37a31c4f888bae5e0279e02e3b : SUCCESS in 8m 28s\n- openstack-tox-py39 https://zuul.opendev.org/t/openstack/build/6085fd57482b4a88ba62047b6e153464 : SUCCESS in 9m 20s (non-voting)\n- openstack-tox-docs https://zuul.opendev.org/t/openstack/build/5fc75dc52a784772a313b9af72e88da3 : SUCCESS in 6m 56s\n- horizon-selenium-headless https://zuul.opendev.org/t/openstack/build/86f7a500caf34ff1a28f10ff8fd6f20b : SUCCESS in 6m 53s\n- horizon-integration-tests https://zuul.opendev.org/t/openstack/build/94c188aa815e4b1e8ab3cc7a6f86c629 : SUCCESS in 1h 26m 58s\n- horizon-tox-bandit-baseline https://zuul.opendev.org/t/openstack/build/5c4ae07812cb4e1db9fe7e1f1e4ce887 : SUCCESS in 4m 52s","accounts_in_message":[],"_revision_number":1},{"id":"28a655af8b9b7194cf8fe5e268951e6a541748e5","author":{"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},"date":"2021-03-02 12:12:21.000000000","message":"Patch Set 1: Code-Review+2\n\nthanks, LGTM.","accounts_in_message":[],"_revision_number":1},{"id":"a085056ac1130ffe9c4c6681fa53c8d6fdf4cc11","author":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"},"date":"2021-03-04 14:41:03.000000000","message":"Patch Set 1: Code-Review+2 Workflow+1","accounts_in_message":[],"_revision_number":1},{"id":"cb0b19c90fb5b4819601dd8b83b041f4d3695035","tag":"autogenerated:zuul:gate","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-03-04 14:41:56.000000000","message":"Patch Set 1: -Verified\n\nStarting gate jobs.","accounts_in_message":[],"_revision_number":1},{"id":"1d0b82becd617f513b0f05b03594465efcad9865","tag":"autogenerated:zuul:gate","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-03-04 16:37:11.000000000","message":"Patch Set 1: Verified-2\n\nBuild failed (gate pipeline).  For information on how to proceed, see\nhttps://docs.opendev.org/opendev/infra-manual/latest/developers.html#automated-testing\n\n\n- horizon-nodejs10-run-lint https://zuul.opendev.org/t/openstack/build/65c861509c23405ca34395688e193f73 : SUCCESS in 8m 57s\n- horizon-nodejs10-run-test https://zuul.opendev.org/t/openstack/build/f9586f6fb9354436a477c7c564281652 : SUCCESS in 9m 22s\n- openstack-tox-py38 https://zuul.opendev.org/t/openstack/build/e97fb6bada7544a4ac969907ee99f656 : SUCCESS in 11m 50s\n- openstack-tox-lower-constraints https://zuul.opendev.org/t/openstack/build/03df6b848eb448feb71720671c3c009d : SUCCESS in 11m 42s\n- openstack-tox-pep8 https://zuul.opendev.org/t/openstack/build/4b245c2c4afe494abfbc085f42dcf8b4 : SUCCESS in 6m 12s\n- openstack-tox-py36 https://zuul.opendev.org/t/openstack/build/4badc56016164287af333f4335c66a75 : SUCCESS in 11m 56s\n- openstack-tox-docs https://zuul.opendev.org/t/openstack/build/9f1bf337462443a4b9f4df6d06ba217c : SUCCESS in 9m 01s\n- horizon-selenium-headless https://zuul.opendev.org/t/openstack/build/74ea2576d53741b98050ad877c6d9bb5 : SUCCESS in 8m 51s\n- horizon-integration-tests https://zuul.opendev.org/t/openstack/build/c986f62bf4f546ac9bca93f9c2c74a82 : FAILURE in 1h 49m 09s","accounts_in_message":[],"_revision_number":1},{"id":"8481a496ad63e85129b3d2b7a5c5f0f275eb4583","author":{"_account_id":29313,"name":"Vishal Manchanda","email":"manchandavishal143@gmail.com","username":"vishalmanchanda"},"date":"2021-03-04 18:49:18.000000000","message":"Patch Set 1:\n\nrecheck.","accounts_in_message":[],"_revision_number":1},{"id":"febb299e5cffe1505c825f7030dd63bd3e14e856","tag":"autogenerated:zuul:check","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-03-04 20:34:23.000000000","message":"Patch Set 1: Verified+1\n\nBuild succeeded (check pipeline).\n\n- horizon-cross-manila-ui-python https://zuul.opendev.org/t/openstack/build/f571df7a7b23495d9ed57de11d2ab263 : SUCCESS in 7m 10s (non-voting)\n- horizon-cross-ironic-ui-npm https://zuul.opendev.org/t/openstack/build/be92160bf85c463c8eb60ae76d97ae6e : SUCCESS in 9m 43s (non-voting)\n- horizon-cross-heat-dashboard-python https://zuul.opendev.org/t/openstack/build/d6fff0cf69674ca0ba35040bf26c0ed8 : SUCCESS in 5m 32s (non-voting)\n- horizon-nodejs10-run-lint https://zuul.opendev.org/t/openstack/build/7f1cc17974f44ea59d4d29180e30f46c : SUCCESS in 18m 39s\n- horizon-nodejs10-run-test https://zuul.opendev.org/t/openstack/build/f3b38cbc0dc84b3bb54a434b7ed54ab9 : SUCCESS in 11m 13s\n- openstack-tox-py38 https://zuul.opendev.org/t/openstack/build/6ea8de281cbf42eca45c80049e708d04 : SUCCESS in 12m 16s\n- openstack-tox-lower-constraints https://zuul.opendev.org/t/openstack/build/48321ef6a4cd498b8b8492eb99acb6a3 : SUCCESS in 10m 13s\n- openstack-tox-pep8 https://zuul.opendev.org/t/openstack/build/f63e105b82ec47f9b64a690399b14fe1 : SUCCESS in 6m 33s\n- openstack-tox-py36 https://zuul.opendev.org/t/openstack/build/b8289bb34888480188d81d65e0425a4a : SUCCESS in 10m 45s\n- openstack-tox-py39 https://zuul.opendev.org/t/openstack/build/e61a50323ec04a45b06e4fb5da3ad6c7 : SUCCESS in 12m 27s (non-voting)\n- openstack-tox-docs https://zuul.opendev.org/t/openstack/build/c8655a72d40049baa16f428aeedd698b : SUCCESS in 8m 40s\n- horizon-selenium-headless https://zuul.opendev.org/t/openstack/build/9fbfe0fe75304d6eadd071ea828df9bd : SUCCESS in 9m 18s\n- horizon-integration-tests https://zuul.opendev.org/t/openstack/build/72cd253ea3304a5699722f5ce52906f5 : SUCCESS in 1h 29m 05s\n- horizon-tox-bandit-baseline https://zuul.opendev.org/t/openstack/build/14c92766a06f41ad8fd3ab612f2533b4 : SUCCESS in 6m 22s","accounts_in_message":[],"_revision_number":1},{"id":"3a6548de08b92e8927e9bc724c7d430c8da9b8fe","tag":"autogenerated:zuul:gate","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-03-04 20:34:45.000000000","message":"Patch Set 1: -Verified\n\nStarting gate jobs.","accounts_in_message":[],"_revision_number":1},{"id":"dc3aef88046bb41a5c6d60fbe58e36daa56709e8","tag":"autogenerated:zuul:gate","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-03-04 21:45:05.000000000","message":"Patch Set 1: Verified+2\n\nBuild succeeded (gate pipeline).\n\n- horizon-nodejs10-run-lint https://zuul.opendev.org/t/openstack/build/2a4bdfae426048938ea25570922cd9ee : SUCCESS in 4m 58s\n- horizon-nodejs10-run-test https://zuul.opendev.org/t/openstack/build/8d0aa8ec5e0a4329887af2783ced75dc : SUCCESS in 12m 49s\n- openstack-tox-py38 https://zuul.opendev.org/t/openstack/build/54128e80fdac4fc3890665865a83a547 : SUCCESS in 7m 24s\n- openstack-tox-lower-constraints https://zuul.opendev.org/t/openstack/build/d1b5335edffb409cb5a55491b9a594d4 : SUCCESS in 11m 47s\n- openstack-tox-pep8 https://zuul.opendev.org/t/openstack/build/1721b3027587418694dd4c9b6444f57b : SUCCESS in 7m 20s\n- openstack-tox-py36 https://zuul.opendev.org/t/openstack/build/d791f09ddd0d44c69ee35c75b110b9d3 : SUCCESS in 10m 34s\n- openstack-tox-docs https://zuul.opendev.org/t/openstack/build/f16e5532cc3e4f2b8740055211609aac : SUCCESS in 6m 27s\n- horizon-selenium-headless https://zuul.opendev.org/t/openstack/build/6c53d735902a47a5bc2b9e1246415b20 : SUCCESS in 8m 17s\n- horizon-integration-tests https://zuul.opendev.org/t/openstack/build/e02ce06ae97a4d8da0e012a9375474ff : SUCCESS in 1h 09m 02s","accounts_in_message":[],"_revision_number":1},{"id":"5ce06831f72ba9861386567f757d40602b02ed6f","tag":"autogenerated:gerrit:merged","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-03-04 21:45:06.000000000","message":"Change has been successfully merged by Zuul","accounts_in_message":[],"_revision_number":1},{"id":"2a89834bc969db8d69992a101610be52cba0b8a0","tag":"autogenerated:zuul:promote","author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"date":"2021-03-04 21:46:41.000000000","message":"Patch Set 1:\n\nBuild succeeded (promote pipeline).\n\n- promote-openstack-tox-docs https://zuul.opendev.org/t/openstack/build/587e3f33beb44c40b2440ec45009e060 : SUCCESS in 55s","accounts_in_message":[],"_revision_number":1}],"current_revision_number":1,"current_revision":"1dd12d8deb229216189b0a075052e104f73de111","revisions":{"1dd12d8deb229216189b0a075052e104f73de111":{"kind":"REWORK","_number":1,"created":"2021-02-26 13:41:28.000000000","uploader":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"ref":"refs/changes/49/777749/1","fetch":{"anonymous http":{"url":"https://review.opendev.org/openstack/horizon","ref":"refs/changes/49/777749/1","commands":{"Checkout":"git fetch https://review.opendev.org/openstack/horizon refs/changes/49/777749/1 \u0026\u0026 git checkout FETCH_HEAD","Cherry Pick":"git fetch https://review.opendev.org/openstack/horizon refs/changes/49/777749/1 \u0026\u0026 git cherry-pick FETCH_HEAD","Format Patch":"git fetch https://review.opendev.org/openstack/horizon refs/changes/49/777749/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD","Pull":"git pull https://review.opendev.org/openstack/horizon refs/changes/49/777749/1"}}},"commit":{"parents":[{"commit":"3fe0802eaa104ad93df74b51559a120cad2c5745","subject":"Fix typo in horizon/exceptions.py","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/horizon/commit/3fe0802eaa104ad93df74b51559a120cad2c5745"}]}],"author":{"name":"Akihiro Motoki","email":"amotoki@gmail.com","date":"2021-02-26 09:29:02.000000000","tz":540},"committer":{"name":"Akihiro Motoki","email":"amotoki@gmail.com","date":"2021-02-26 09:44:11.000000000","tz":540},"subject":"test: Ensure to stop mock when create_mocks decorator exits","message":"test: Ensure to stop mock when create_mocks decorator exits\n\nDuring reviewing https://review.opendev.org/c/openstack/horizon/+/772603,\nwe noticed that a method decorated by create_mocks is called multiple time\nin a single test. Previously create_mocks decorator does not stop mocking,\nso this means that multiple active mock can exist for one method.\nIn general, it is not a good idea to mock a method multiple times at the\nsame time.\n\nTo cope with this situation, this commit ensures for create_mocks decorator\nto stop active mocks when exiting the decorator.\n\nThis works for most cases, but it does not work only when mocking and\nassertions are handled by separate methods and test logic is placed between\nthem. To cope with this, \"stop_mock\" optional argument is introduced.\n\nFYI: Details on why \"stop_mock\" is needed.\nI explored various ways but could not find a good way so far.\ncreate_mocks needs to be a decorator as it needs to refer an object\nreference (self). On the other hand, if we would like to merge the logic of\nmocking and assertions (for example, _stub_api_calls() and _check_api_calls()\nin openstack_dashboard/dashboards/project/overview/tests.py), a context\nmanager would be good as we would like to call it inside a class.\nHowever, we cannot mix a decorator and a context manger as a decorator is\nexecuted when a context manager is iniitialized and stopping mock in\nthe create_mocks decorator is done during the initialization of the\ncontext manager and methods are not mocked when test code is run.\n\nChange-Id: I9e37dc1eaa08adf36d11975fed6f5a0a90cdde52\n","web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/horizon/commit/1dd12d8deb229216189b0a075052e104f73de111"}],"resolve_conflicts_web_links":[{"name":"gitea","tooltip":"Open in GitWeb","url":"https://opendev.org/openstack/horizon/commit/1dd12d8deb229216189b0a075052e104f73de111"}]},"branch":"refs/heads/master"}},"requirements":[],"submit_records":[{"status":"CLOSED","labels":[{"label":"Verified","status":"OK","applied_by":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]}},{"label":"Code-Review","status":"OK","applied_by":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"}},{"label":"Workflow","status":"OK","applied_by":{"_account_id":8648,"name":"Radomir Dopieralski","email":"openstack@dopieralski.pl","username":"thesheep"}}]}],"submit_requirements":[{"name":"Verified","status":"SATISFIED","is_legacy":true,"submittability_expression_result":{"expression":"label:Verified\u003dCustom-Rule","fulfilled":true,"status":"PASS","passing_atoms":["label:Verified\u003dCustom-Rule"],"failing_atoms":[],"atom_explanations":{}}},{"name":"Workflow","status":"SATISFIED","is_legacy":true,"submittability_expression_result":{"expression":"label:Workflow\u003dCustom-Rule","fulfilled":true,"status":"PASS","passing_atoms":["label:Workflow\u003dCustom-Rule"],"failing_atoms":[],"atom_explanations":{}}},{"name":"Code-Review","status":"SATISFIED","is_legacy":true,"submittability_expression_result":{"expression":"label:Code-Review\u003dCustom-Rule","fulfilled":true,"status":"PASS","passing_atoms":["label:Code-Review\u003dCustom-Rule"],"failing_atoms":[],"atom_explanations":{}}}]}
