]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge "Use assertTrue(observed) instead of assertEqual(True, observed)"
authorJenkins <jenkins@review.openstack.org>
Mon, 12 Oct 2015 09:13:37 +0000 (09:13 +0000)
committerGerrit Code Review <review@openstack.org>
Mon, 12 Oct 2015 09:13:37 +0000 (09:13 +0000)
1  2 
doc/source/devref/effective_neutron.rst
neutron/tests/unit/agent/l3/test_agent.py
neutron/tests/unit/db/test_db_base_plugin_v2.py
neutron/tests/unit/extensions/test_l3.py
neutron/tests/unit/test_policy.py

index bed9740c9252281c460fa628f230ff9f9f2157c2,019b9f92ec9379cac2d32f1e931e25d91f043a72..9140586c9859e3fe2c4087bdafc9e5497e5ff732
@@@ -101,26 -103,27 +101,26 @@@ class PolicyTestCase(base.BaseTestCase)
      def test_enforce_good_action(self):
          action = "example:allowed"
          result = policy.enforce(self.context, action, self.target)
-         self.assertEqual(result, True)
+         self.assertTrue(result)
  
 -    @mock.patch.object(urlrequest, 'urlopen',
 -                       return_value=six.StringIO("True"))
 -    def test_enforce_http_true(self, mock_urlrequest):
 +    #TODO(kevinbenton): replace these private method mocks with a fixture
 +    @mock.patch.object(oslo_policy._checks.HttpCheck, '__call__',
 +                       return_value=True)
 +    def test_enforce_http_true(self, mock_httpcheck):
          action = "example:get_http"
          target = {}
          result = policy.enforce(self.context, action, target)
-         self.assertEqual(result, True)
+         self.assertTrue(result)
  
 -    def test_enforce_http_false(self):
 -
 -        def fakeurlopen(url, post_data):
 -            return six.StringIO("False")
 -
 -        with mock.patch.object(urlrequest, 'urlopen', new=fakeurlopen):
 -            action = "example:get_http"
 -            target = {}
 -            self.assertRaises(oslo_policy.PolicyNotAuthorized,
 -                              policy.enforce, self.context,
 -                              action, target)
 +    #TODO(kevinbenton): replace these private method mocks with a fixture
 +    @mock.patch.object(oslo_policy._checks.HttpCheck, '__call__',
 +                       return_value=False)
 +    def test_enforce_http_false(self, mock_httpcheck):
 +        action = "example:get_http"
 +        target = {}
 +        self.assertRaises(oslo_policy.PolicyNotAuthorized,
 +                          policy.enforce, self.context,
 +                          action, target)
  
      def test_templatized_enforcement(self):
          target_mine = {'tenant_id': 'fake'}