Browse Source

Modify assert statement when comparing with None

Replace assertEqual(None, *) with assertIsNone in glance's
tests to have more clear messages in case of failure.

Also, replace assertTrue(* is not None) with assertIsNotNone
for the same reason.

Change-Id: If41a71bd750057c7136b03bef94c04517092134c
Closes-Bug: #1280522
tags/2014.1.b3
Jia Dong 5 years ago
parent
commit
8d4312a2c9

+ 16
- 16
glance/tests/functional/db/base.py View File

@@ -137,19 +137,19 @@ class DriverTests(object):
137 137
                   'updated_at': create_time}
138 138
         image = self.db_api.image_create(self.context, values)
139 139
 
140
-        self.assertEqual(None, image['name'])
141
-        self.assertEqual(None, image['container_format'])
140
+        self.assertIsNone(image['name'])
141
+        self.assertIsNone(image['container_format'])
142 142
         self.assertEqual(0, image['min_ram'])
143 143
         self.assertEqual(0, image['min_disk'])
144
-        self.assertEqual(None, image['owner'])
144
+        self.assertIsNone(image['owner'])
145 145
         self.assertEqual(False, image['is_public'])
146
-        self.assertEqual(None, image['size'])
147
-        self.assertEqual(None, image['checksum'])
148
-        self.assertEqual(None, image['disk_format'])
146
+        self.assertIsNone(image['size'])
147
+        self.assertIsNone(image['checksum'])
148
+        self.assertIsNone(image['disk_format'])
149 149
         self.assertEqual([], image['locations'])
150 150
         self.assertEqual(False, image['protected'])
151 151
         self.assertEqual(False, image['deleted'])
152
-        self.assertEqual(None, image['deleted_at'])
152
+        self.assertIsNone(image['deleted_at'])
153 153
         self.assertEqual([], image['properties'])
154 154
         self.assertEqual(image['created_at'], create_time)
155 155
         self.assertEqual(image['updated_at'], create_time)
@@ -259,7 +259,7 @@ class DriverTests(object):
259 259
         prop = self.db_api.image_property_create(self.context, fixture)
260 260
         prop = self.db_api.image_property_delete(self.context,
261 261
                                                  prop['name'], UUID1)
262
-        self.assertNotEqual(prop['deleted_at'], None)
262
+        self.assertIsNotNone(prop['deleted_at'])
263 263
         self.assertTrue(prop['deleted'])
264 264
 
265 265
     def test_image_get(self):
@@ -959,8 +959,8 @@ class DriverTests(object):
959 959
         memberships = self.db_api.image_member_find(self.context)
960 960
         self.assertEqual(1, len(memberships))
961 961
         actual = memberships[0]
962
-        self.assertNotEqual(actual['created_at'], None)
963
-        self.assertNotEqual(actual['updated_at'], None)
962
+        self.assertIsNotNone(actual['created_at'])
963
+        self.assertIsNotNone(actual['updated_at'])
964 964
         actual.pop('id')
965 965
         actual.pop('created_at')
966 966
         actual.pop('updated_at')
@@ -1504,9 +1504,9 @@ class TaskTests(test_utils.BaseTestCase):
1504 1504
         self.assertEqual(task['owner'], self.context.owner)
1505 1505
         self.assertEqual(task['type'], 'export')
1506 1506
         self.assertEqual(task['status'], 'pending')
1507
-        self.assertEqual(task['input'], None)
1508
-        self.assertEqual(task['result'], None)
1509
-        self.assertEqual(task['message'], None)
1507
+        self.assertIsNone(task['input'])
1508
+        self.assertIsNone(task['result'])
1509
+        self.assertIsNone(task['message'])
1510 1510
 
1511 1511
     def test_task_update(self):
1512 1512
         self.context.tenant = str(uuid.uuid4())
@@ -1551,9 +1551,9 @@ class TaskTests(test_utils.BaseTestCase):
1551 1551
         self.assertEqual(task['owner'], self.context.owner)
1552 1552
         self.assertEqual(task['type'], 'import')
1553 1553
         self.assertEqual(task['status'], 'processing')
1554
-        self.assertEqual(task['input'], None)
1555
-        self.assertEqual(task['result'], None)
1556
-        self.assertEqual(task['message'], None)
1554
+        self.assertIsNone(task['input'])
1555
+        self.assertIsNone(task['result'])
1556
+        self.assertIsNone(task['message'])
1557 1557
         self.assertEqual(task['deleted'], False)
1558 1558
         self.assertIsNone(task['deleted_at'])
1559 1559
         self.assertIsNone(task['expires_at'])

+ 1
- 1
glance/tests/functional/test_gzip_middleware.py View File

@@ -38,7 +38,7 @@ class GzipMiddlewareTest(functional.FunctionalTest):
38 38
         # Accept-Encoding: Identity
39 39
         headers = {'Accept-Encoding': 'identity'}
40 40
         response, content = request('images', headers=headers)
41
-        self.assertEqual(response.get("-content-encoding"), None)
41
+        self.assertIsNone(response.get("-content-encoding"))
42 42
 
43 43
         # Accept-Encoding: gzip
44 44
         headers = {'Accept-Encoding': 'gzip'}

+ 2
- 2
glance/tests/functional/v1/test_ssl.py View File

@@ -379,7 +379,7 @@ class TestSSL(functional.FunctionalTest):
379 379
         response, content = https.request(path, 'POST', headers=headers)
380 380
         self.assertEqual(response.status, 201)
381 381
         data = jsonutils.loads(content)
382
-        self.assertEqual(data['image']['checksum'], None)
382
+        self.assertIsNone(data['image']['checksum'])
383 383
         self.assertEqual(data['image']['size'], 0)
384 384
         self.assertEqual(data['image']['container_format'], 'ovf')
385 385
         self.assertEqual(data['image']['disk_format'], 'raw')
@@ -396,7 +396,7 @@ class TestSSL(functional.FunctionalTest):
396 396
         self.assertEqual(response.status, 200)
397 397
         data = jsonutils.loads(content)
398 398
         self.assertEqual(data['images'][0]['id'], image_id)
399
-        self.assertEqual(data['images'][0]['checksum'], None)
399
+        self.assertIsNone(data['images'][0]['checksum'])
400 400
         self.assertEqual(data['images'][0]['size'], 0)
401 401
         self.assertEqual(data['images'][0]['container_format'], 'ovf')
402 402
         self.assertEqual(data['images'][0]['disk_format'], 'raw')

+ 2
- 2
glance/tests/integration/legacy_functional/test_v1_api.py View File

@@ -255,7 +255,7 @@ class TestApi(base.ApiTest):
255 255
         response, content = self.http.request(path, 'POST', headers=headers)
256 256
         self.assertEqual(response.status, 201)
257 257
         data = jsonutils.loads(content)
258
-        self.assertEqual(data['image']['checksum'], None)
258
+        self.assertIsNone(data['image']['checksum'])
259 259
         self.assertEqual(data['image']['size'], 0)
260 260
         self.assertEqual(data['image']['container_format'], 'ovf')
261 261
         self.assertEqual(data['image']['disk_format'], 'raw')
@@ -271,7 +271,7 @@ class TestApi(base.ApiTest):
271 271
         self.assertEqual(response.status, 200)
272 272
         data = jsonutils.loads(content)
273 273
         self.assertEqual(data['images'][0]['id'], image_id)
274
-        self.assertEqual(data['images'][0]['checksum'], None)
274
+        self.assertIsNone(data['images'][0]['checksum'])
275 275
         self.assertEqual(data['images'][0]['size'], 0)
276 276
         self.assertEqual(data['images'][0]['container_format'], 'ovf')
277 277
         self.assertEqual(data['images'][0]['disk_format'], 'raw')

+ 1
- 1
glance/tests/unit/api/middleware/test_cache_manage.py View File

@@ -42,7 +42,7 @@ class TestCacheManageFilter(test_utils.BaseTestCase):
42 42
         resource = self.cache_manage_filter.process_request(bogus_request)
43 43
 
44 44
         #check
45
-        self.assertEqual(None, resource)
45
+        self.assertIsNone(resource)
46 46
 
47 47
     @mock.patch.object(cached_images.Controller, "get_cached_images")
48 48
     def test_get_cached_images(self,

+ 2
- 2
glance/tests/unit/common/test_location_strategy.py View File

@@ -129,8 +129,8 @@ class TestLocationStrategy(base.IsolatedUnitTest):
129 129
         self.assertEqual(original_locs, ordered_locs)
130 130
 
131 131
     def test_choose_best_location_with_none_or_empty_locations(self):
132
-        self.assertEqual(location_strategy.choose_best_location(None), None)
133
-        self.assertEqual(location_strategy.choose_best_location([]), None)
132
+        self.assertIsNone(location_strategy.choose_best_location(None))
133
+        self.assertIsNone(location_strategy.choose_best_location([]))
134 134
 
135 135
     def test_choose_best_location(self):
136 136
         self.config(location_strategy='location_order')

+ 1
- 1
glance/tests/unit/test_auth.py View File

@@ -803,7 +803,7 @@ class TestImageFactoryProxy(utils.BaseTestCase):
803 803
     def test_admin_can_set_owner_to_none(self):
804 804
         self.context.is_admin = True
805 805
         image = self.image_factory.new_image(owner=None)
806
-        self.assertEqual(image.owner, None)
806
+        self.assertIsNone(image.owner)
807 807
 
808 808
     def test_admin_still_gets_default_tenant(self):
809 809
         self.context.is_admin = True

+ 3
- 3
glance/tests/unit/test_cache_middleware.py View File

@@ -77,7 +77,7 @@ class TestCacheMiddlewareRequestStashCacheInfo(testtools.TestCase):
77 77
 
78 78
     def test_fetch_cache_request_info_unset(self):
79 79
         out = self.middleware._fetch_request_info(self.request)
80
-        self.assertEqual(out, None)
80
+        self.assertIsNone(out)
81 81
 
82 82
 
83 83
 class ChecksumTestCacheFilter(glance.api.middleware.cache.CacheFilter):
@@ -121,7 +121,7 @@ class TestCacheMiddlewareChecksumVerification(base.IsolatedUnitTest):
121 121
         resp = webob.Response(request=self.request)
122 122
         cache_filter._process_GET_response(resp, None)
123 123
 
124
-        self.assertEqual(None, cache_filter.cache.image_checksum)
124
+        self.assertIsNone(cache_filter.cache.image_checksum)
125 125
 
126 126
 
127 127
 class FakeImageSerializer(object):
@@ -327,7 +327,7 @@ class TestCacheMiddlewareProcessRequest(base.IsolatedUnitTest):
327 327
         self.set_policy_rules(rules)
328 328
         cache_filter.policy = glance.api.policy.Enforcer()
329 329
 
330
-        self.assertEqual(None, cache_filter.process_request(request))
330
+        self.assertIsNone(cache_filter.process_request(request))
331 331
 
332 332
 
333 333
 class TestCacheMiddlewareProcessResponse(base.IsolatedUnitTest):

+ 6
- 6
glance/tests/unit/test_context_middleware.py View File

@@ -92,9 +92,9 @@ class TestContextMiddleware(base.IsolatedUnitTest):
92 92
         self.config(allow_anonymous_access=True)
93 93
         middleware = self._build_middleware()
94 94
         middleware.process_request(req)
95
-        self.assertEqual(req.context.auth_tok, None)
96
-        self.assertEqual(req.context.user, None)
97
-        self.assertEqual(req.context.tenant, None)
95
+        self.assertIsNone(req.context.auth_tok)
96
+        self.assertIsNone(req.context.user)
97
+        self.assertIsNone(req.context.tenant)
98 98
         self.assertEqual(req.context.roles, [])
99 99
         self.assertFalse(req.context.is_admin)
100 100
         self.assertTrue(req.context.read_only)
@@ -124,9 +124,9 @@ class TestUnauthenticatedContextMiddleware(base.IsolatedUnitTest):
124 124
         middleware = context.UnauthenticatedContextMiddleware(None)
125 125
         req = webob.Request.blank('/')
126 126
         middleware.process_request(req)
127
-        self.assertEqual(req.context.auth_tok, None)
128
-        self.assertEqual(req.context.user, None)
129
-        self.assertEqual(req.context.tenant, None)
127
+        self.assertIsNone(req.context.auth_tok)
128
+        self.assertIsNone(req.context.user)
129
+        self.assertIsNone(req.context.tenant)
130 130
         self.assertEqual(req.context.roles, [])
131 131
         self.assertTrue(req.context.is_admin)
132 132
 

+ 12
- 12
glance/tests/unit/test_domain.py View File

@@ -46,14 +46,14 @@ class TestImageFactory(test_utils.BaseTestCase):
46 46
         self.assertEqual(image.created_at, image.updated_at)
47 47
         self.assertEqual(image.status, 'queued')
48 48
         self.assertEqual(image.visibility, 'private')
49
-        self.assertEqual(image.owner, None)
50
-        self.assertEqual(image.name, None)
51
-        self.assertEqual(image.size, None)
49
+        self.assertIsNone(image.owner)
50
+        self.assertIsNone(image.name)
51
+        self.assertIsNone(image.size)
52 52
         self.assertEqual(image.min_disk, 0)
53 53
         self.assertEqual(image.min_ram, 0)
54 54
         self.assertEqual(image.protected, False)
55
-        self.assertEqual(image.disk_format, None)
56
-        self.assertEqual(image.container_format, None)
55
+        self.assertIsNone(image.disk_format)
56
+        self.assertIsNone(image.container_format)
57 57
         self.assertEqual(image.extra_properties, {})
58 58
         self.assertEqual(image.tags, set([]))
59 59
 
@@ -68,12 +68,12 @@ class TestImageFactory(test_utils.BaseTestCase):
68 68
         self.assertEqual(image.visibility, 'private')
69 69
         self.assertEqual(image.owner, TENANT1)
70 70
         self.assertEqual(image.name, 'image-1')
71
-        self.assertEqual(image.size, None)
71
+        self.assertIsNone(image.size)
72 72
         self.assertEqual(image.min_disk, 256)
73 73
         self.assertEqual(image.min_ram, 0)
74 74
         self.assertEqual(image.protected, False)
75
-        self.assertEqual(image.disk_format, None)
76
-        self.assertEqual(image.container_format, None)
75
+        self.assertIsNone(image.disk_format)
76
+        self.assertIsNone(image.container_format)
77 77
         self.assertEqual(image.extra_properties, {})
78 78
         self.assertEqual(image.tags, set([]))
79 79
 
@@ -89,14 +89,14 @@ class TestImageFactory(test_utils.BaseTestCase):
89 89
         self.assertEqual(image.created_at, image.updated_at)
90 90
         self.assertEqual(image.status, 'queued')
91 91
         self.assertEqual(image.visibility, 'private')
92
-        self.assertEqual(image.owner, None)
92
+        self.assertIsNone(image.owner)
93 93
         self.assertEqual(image.name, 'image-1')
94
-        self.assertEqual(image.size, None)
94
+        self.assertIsNone(image.size)
95 95
         self.assertEqual(image.min_disk, 0)
96 96
         self.assertEqual(image.min_ram, 0)
97 97
         self.assertEqual(image.protected, False)
98
-        self.assertEqual(image.disk_format, None)
99
-        self.assertEqual(image.container_format, None)
98
+        self.assertIsNone(image.disk_format)
99
+        self.assertIsNone(image.container_format)
100 100
         self.assertEqual(image.extra_properties, {'foo': 'bar'})
101 101
         self.assertEqual(image.tags, set(['one', 'two']))
102 102
 

+ 10
- 10
glance/tests/unit/test_store_location.py View File

@@ -154,7 +154,7 @@ class TestStoreLocation(base.StoreClearingUnitTest):
154 154
         self.assertEqual("https://example.com", loc.swift_url)
155 155
         self.assertEqual("images", loc.container)
156 156
         self.assertEqual("1", loc.obj)
157
-        self.assertEqual(None, loc.user)
157
+        self.assertIsNone(loc.user)
158 158
         self.assertEqual(uri, loc.get_uri())
159 159
 
160 160
         uri = 'swift+https://user:pass@authurl.com/images/1'
@@ -203,8 +203,8 @@ class TestStoreLocation(base.StoreClearingUnitTest):
203 203
         self.assertEqual("http://storeurl.com/v1", loc.swift_url)
204 204
         self.assertEqual("container", loc.container)
205 205
         self.assertEqual("12345", loc.obj)
206
-        self.assertEqual(None, loc.user)
207
-        self.assertEqual(None, loc.key)
206
+        self.assertIsNone(loc.user)
207
+        self.assertIsNone(loc.key)
208 208
         self.assertEqual(uri, loc.get_uri())
209 209
 
210 210
         bad_uri = 'swif://'
@@ -231,7 +231,7 @@ class TestStoreLocation(base.StoreClearingUnitTest):
231 231
         self.assertEqual("example.com", loc.s3serviceurl)
232 232
         self.assertEqual("images", loc.bucket)
233 233
         self.assertEqual("1", loc.key)
234
-        self.assertEqual(None, loc.accesskey)
234
+        self.assertIsNone(loc.accesskey)
235 235
         self.assertEqual(uri, loc.get_uri())
236 236
 
237 237
         uri = 's3+https://accesskey:pass@s3serviceurl.com/images/1'
@@ -288,18 +288,18 @@ class TestStoreLocation(base.StoreClearingUnitTest):
288 288
         loc.parse_uri(uri)
289 289
 
290 290
         self.assertEqual('imagename', loc.image)
291
-        self.assertEqual(None, loc.fsid)
292
-        self.assertEqual(None, loc.pool)
293
-        self.assertEqual(None, loc.snapshot)
291
+        self.assertIsNone(loc.fsid)
292
+        self.assertIsNone(loc.pool)
293
+        self.assertIsNone(loc.snapshot)
294 294
 
295 295
         uri = u'rbd://imagename'
296 296
         loc = glance.store.rbd.StoreLocation({})
297 297
         loc.parse_uri(uri)
298 298
 
299 299
         self.assertEqual('imagename', loc.image)
300
-        self.assertEqual(None, loc.fsid)
301
-        self.assertEqual(None, loc.pool)
302
-        self.assertEqual(None, loc.snapshot)
300
+        self.assertIsNone(loc.fsid)
301
+        self.assertIsNone(loc.pool)
302
+        self.assertIsNone(loc.snapshot)
303 303
 
304 304
         uri = 'rbd://fsid/pool/image/snap'
305 305
         loc = glance.store.rbd.StoreLocation({})

+ 7
- 7
glance/tests/unit/test_swift_store.py View File

@@ -789,8 +789,8 @@ class TestSingleTenantStoreConnections(base.IsolatedUnitTest):
789 789
         self.assertEqual(connection.tenant_name, 'tenant')
790 790
         self.assertEqual(connection.key, 'abcdefg')
791 791
         self.assertFalse(connection.snet)
792
-        self.assertEqual(connection.preauthurl, None)
793
-        self.assertEqual(connection.preauthtoken, None)
792
+        self.assertIsNone(connection.preauthurl)
793
+        self.assertIsNone(connection.preauthtoken)
794 794
         self.assertFalse(connection.insecure)
795 795
         self.assertEqual(connection.os_options,
796 796
                          {'service_type': 'object-store',
@@ -814,7 +814,7 @@ class TestSingleTenantStoreConnections(base.IsolatedUnitTest):
814 814
         connection = self.store.get_connection(self.location)
815 815
         self.assertEqual(connection.auth_version, '1')
816 816
         self.assertEqual(connection.user, 'auth_v1_user')
817
-        self.assertEqual(connection.tenant_name, None)
817
+        self.assertIsNone(connection.tenant_name)
818 818
 
819 819
     def test_connection_invalid_user(self):
820 820
         self.store.configure()
@@ -876,11 +876,11 @@ class TestMultiTenantStoreConnections(base.IsolatedUnitTest):
876 876
     def test_basic_connection(self):
877 877
         self.store.configure()
878 878
         connection = self.store.get_connection(self.location)
879
-        self.assertEqual(connection.authurl, None)
879
+        self.assertIsNone(connection.authurl)
880 880
         self.assertEqual(connection.auth_version, '2')
881 881
         self.assertEqual(connection.user, 'user')
882 882
         self.assertEqual(connection.tenant_name, 'tenant')
883
-        self.assertEqual(connection.key, None)
883
+        self.assertIsNone(connection.key)
884 884
         self.assertFalse(connection.snet)
885 885
         self.assertEqual(connection.preauthurl, 'https://example.com')
886 886
         self.assertEqual(connection.preauthtoken, '0123')
@@ -943,8 +943,8 @@ class TestCreatingLocations(base.IsolatedUnitTest):
943 943
         self.assertEqual(location.swift_url, 'https://some_endpoint')
944 944
         self.assertEqual(location.container, 'container_image-id')
945 945
         self.assertEqual(location.obj, 'image-id')
946
-        self.assertEqual(location.user, None)
947
-        self.assertEqual(location.key, None)
946
+        self.assertIsNone(location.user)
947
+        self.assertIsNone(location.key)
948 948
         self.assertEqual(fake_get_endpoint.service_type, 'object-store')
949 949
 
950 950
     def test_multi_tenant_location_http(self):

+ 3
- 3
glance/tests/unit/v1/test_registry_client.py View File

@@ -849,7 +849,7 @@ class TestRegistryV1ClientApi(base.IsolatedUnitTest):
849 849
 
850 850
     def test_get_registry_client(self):
851 851
         actual_client = rapi.get_registry_client(self.context)
852
-        self.assertEqual(actual_client.identity_headers, None)
852
+        self.assertIsNone(actual_client.identity_headers)
853 853
 
854 854
     def test_get_registry_client_with_identity_headers(self):
855 855
         self.config(send_identity_headers=True)
@@ -895,7 +895,7 @@ class TestRegistryV1ClientApi(base.IsolatedUnitTest):
895 895
         self.config(auth_region=expected['region'])
896 896
         self.stubs.Set(os, 'getenv', lambda x: None)
897 897
 
898
-        self.assertEqual(rapi._CLIENT_CREDS, None)
898
+        self.assertIsNone(rapi._CLIENT_CREDS)
899 899
         rapi.configure_registry_admin_creds()
900 900
         self.assertEqual(rapi._CLIENT_CREDS, expected)
901 901
 
@@ -908,7 +908,7 @@ class TestRegistryV1ClientApi(base.IsolatedUnitTest):
908 908
         self.config(auth_strategy='test_strategy')
909 909
         self.config(auth_region=expected['region'])
910 910
 
911
-        self.assertEqual(rapi._CLIENT_CREDS, None)
911
+        self.assertIsNone(rapi._CLIENT_CREDS)
912 912
         rapi.configure_registry_admin_creds()
913 913
         self.assertEqual(rapi._CLIENT_CREDS, expected)
914 914
 

+ 1
- 1
glance/tests/unit/v2/test_image_data_resource.py View File

@@ -169,7 +169,7 @@ class TestImagesController(base.StoreClearingUnitTest):
169 169
         self.image_repo.result = image
170 170
         self.controller.upload(request, unit_test_utils.UUID2, 'YYYY', None)
171 171
         self.assertEqual(image.data, 'YYYY')
172
-        self.assertEqual(image.size, None)
172
+        self.assertIsNone(image.size)
173 173
 
174 174
     def test_upload_invalid(self):
175 175
         request = unit_test_utils.get_fake_request()

+ 4
- 4
glance/tests/unit/v2/test_images_resource.py View File

@@ -1257,7 +1257,7 @@ class TestImagesController(base.IsolatedUnitTest):
1257 1257
         self.assertEqual(output.image_id, UUID1)
1258 1258
         self.assertEqual(len(output.locations), 0)
1259 1259
         self.assertEqual(output.status, 'queued')
1260
-        self.assertEqual(output.size, None)
1260
+        self.assertIsNone(output.size)
1261 1261
 
1262 1262
         new_location = {'url': '%s/fake_location' % BASE_URI, 'metadata': {}}
1263 1263
         changes = [{'op': 'replace', 'path': ['locations'],
@@ -1587,7 +1587,7 @@ class TestImagesController(base.IsolatedUnitTest):
1587 1587
         self.assertEqual(output.image_id, UUID1)
1588 1588
         self.assertEqual(len(output.locations), 0)
1589 1589
         self.assertTrue(output.status == 'queued')
1590
-        self.assertEqual(output.size, None)
1590
+        self.assertIsNone(output.size)
1591 1591
 
1592 1592
         new_location = {'url': '%s/fake_location' % BASE_URI, 'metadata': {}}
1593 1593
         changes = [{'op': 'add', 'path': ['locations', '-'],
@@ -1770,9 +1770,9 @@ class TestImagesController(base.IsolatedUnitTest):
1770 1770
 
1771 1771
     def test_invalid_locations_op_pos(self):
1772 1772
         pos = self.controller._get_locations_op_pos(None, 2, True)
1773
-        self.assertEqual(pos, None)
1773
+        self.assertIsNone(pos)
1774 1774
         pos = self.controller._get_locations_op_pos('1', None, True)
1775
-        self.assertEqual(pos, None)
1775
+        self.assertIsNone(pos)
1776 1776
 
1777 1777
 
1778 1778
 class TestImagesControllerPolicies(base.IsolatedUnitTest):

+ 2
- 2
glance/tests/unit/v2/test_registry_client.py View File

@@ -625,7 +625,7 @@ class TestRegistryV2ClientApi(base.IsolatedUnitTest):
625 625
         self.config(auth_region=expected['region'])
626 626
         self.stubs.Set(os, 'getenv', lambda x: None)
627 627
 
628
-        self.assertEqual(rapi._CLIENT_CREDS, None)
628
+        self.assertIsNone(rapi._CLIENT_CREDS)
629 629
         rapi.configure_registry_admin_creds()
630 630
         self.assertEqual(rapi._CLIENT_CREDS, expected)
631 631
 
@@ -638,6 +638,6 @@ class TestRegistryV2ClientApi(base.IsolatedUnitTest):
638 638
         self.config(auth_strategy='test_strategy')
639 639
         self.config(auth_region=expected['region'])
640 640
 
641
-        self.assertEqual(rapi._CLIENT_CREDS, None)
641
+        self.assertIsNone(rapi._CLIENT_CREDS)
642 642
         rapi.configure_registry_admin_creds()
643 643
         self.assertEqual(rapi._CLIENT_CREDS, expected)

Loading…
Cancel
Save