aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject aurora git commit: Fix a Python unittest that is not asserting anything
Date Tue, 30 Aug 2016 20:52:34 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 65d63132c -> bd11b1c51


Fix a Python unittest that is not asserting anything

I discovered this one during a failed attempt to update to a new mock version. I have only
aimed for a minimal fix:

* incorrect usage of PropertyMock: https://docs.python.org/dev/library/unittest.mock.html#unittest.mock.PropertyMock
* assert_called_once() does not exist: https://engineeringblog.yelp.com/2015/02/assert_called_once-threat-or-menace.html

Reviewed at https://reviews.apache.org/r/51535/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/bd11b1c5
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/bd11b1c5
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/bd11b1c5

Branch: refs/heads/master
Commit: bd11b1c512f2a762c62d79e0385233504870e1b7
Parents: 65d6313
Author: Stephan Erb <serb@apache.org>
Authored: Tue Aug 30 22:52:00 2016 +0200
Committer: Stephan Erb <serb@apache.org>
Committed: Tue Aug 30 22:52:00 2016 +0200

----------------------------------------------------------------------
 src/test/python/apache/aurora/admin/test_admin.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/bd11b1c5/src/test/python/apache/aurora/admin/test_admin.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/admin/test_admin.py b/src/test/python/apache/aurora/admin/test_admin.py
index fd3b919..eb193c4 100644
--- a/src/test/python/apache/aurora/admin/test_admin.py
+++ b/src/test/python/apache/aurora/admin/test_admin.py
@@ -198,7 +198,7 @@ class TestGetSchedulerCommand(AuroraClientCommandTest):
     mock_scheduler_client = create_autospec(spec=SchedulerClient, instance=True)
     mock_raw_url = PropertyMock(return_value="url")
     mock_proxy.scheduler_client.return_value = mock_scheduler_client
-    mock_scheduler_client.raw_url = mock_raw_url
+    type(mock_scheduler_client).raw_url = mock_raw_url
 
     with contextlib.nested(
         patch('twitter.common.app.get_options', return_value=mock_options),
@@ -208,8 +208,8 @@ class TestGetSchedulerCommand(AuroraClientCommandTest):
     ) as (_, mock_make_admin_client, _):
 
       api = mock_make_admin_client.return_value
-      api.scheduler_proxy = PropertyMock(return_value=mock_proxy)
+      type(api).scheduler_proxy = PropertyMock(return_value=mock_proxy)
 
       get_scheduler([self.TEST_CLUSTER])
 
-      mock_raw_url.assert_called_once()
+      mock_raw_url.assert_called_once_with()


Mime
View raw message