Browse Source

Merge "Replace assertEquals with assertEqual"

Jenkins 1 year ago
parent
commit
d1cdda0fb4
2 changed files with 18 additions and 18 deletions
  1. 17
    17
      tests/unit/test_os_utils.py
  2. 1
    1
      tests/unit/test_utils.py

+ 17
- 17
tests/unit/test_os_utils.py View File

@@ -169,7 +169,7 @@ class TestOsUtils(unittest.TestCase):
169 169
                 interface='test-interface'
170 170
             )
171 171
             u = 'https://127.0.1.1/test-interface/test/path'
172
-            self.assertEquals(limits, {'url': u})
172
+            self.assertEqual(limits, {'url': u})
173 173
 
174 174
     def test_get_consumer_usage(self):
175 175
         """Test retrieving consumer usage."""
@@ -184,26 +184,26 @@ class TestOsUtils(unittest.TestCase):
184 184
             servers = self.osu.get_consumer_usage(
185 185
                 servers=[OpenStackObject(0, 'test0').to_dict()]
186 186
             )
187
-            self.assertEquals(len(servers), 6)
187
+            self.assertEqual(len(servers), 6)
188 188
 
189 189
     def test_get_consumer_usage_with_marker(self):
190 190
         """Test retrieving consumer usage."""
191 191
         with mock.patch('openstack.connection.Connection') as MockClass:
192 192
             MockClass.return_value = MockedOpenStackConn()
193 193
             servers = self.osu.get_consumer_usage(marker=5)
194
-            self.assertEquals(len(servers), 0)
194
+            self.assertEqual(len(servers), 0)
195 195
 
196 196
         with mock.patch('openstack.connection.Connection') as MockClass:
197 197
             MockClass.return_value = MockedOpenStackConn()
198 198
             servers = self.osu.get_consumer_usage(marker=2)
199
-            self.assertEquals(len(servers), 3)
199
+            self.assertEqual(len(servers), 3)
200 200
 
201 201
     def test_get_consumer_usage_with_limit(self):
202 202
         """Test retrieving consumer usage."""
203 203
         with mock.patch('openstack.connection.Connection') as MockClass:
204 204
             MockClass.return_value = MockedOpenStackConn()
205 205
             servers = self.osu.get_consumer_usage(limit=1)
206
-            self.assertEquals(len(servers), 5)
206
+            self.assertEqual(len(servers), 5)
207 207
 
208 208
     def test_get_compute_limits(self):
209 209
         """Test retrieving consumer limits."""
@@ -211,7 +211,7 @@ class TestOsUtils(unittest.TestCase):
211 211
             MockClass.return_value = MockedOpenStackConn()
212 212
             limits = self.osu.get_compute_limits(project_id='not-a-uuid1')
213 213
             u = 'https://127.0.1.1/os-quota-sets/not-a-uuid1'
214
-            self.assertEquals(limits, {'url': u})
214
+            self.assertEqual(limits, {'url': u})
215 215
 
216 216
     def test_get_compute_limits_interface_set(self):
217 217
         """Test retrieving consumer limits."""
@@ -222,51 +222,51 @@ class TestOsUtils(unittest.TestCase):
222 222
                 project_id='not-a-uuid2'
223 223
             )
224 224
             u = 'https://127.0.1.1/os-quota-sets/not-a-uuid2'
225
-            self.assertEquals(limits, {'url': u})
225
+            self.assertEqual(limits, {'url': u})
226 226
 
227 227
     def test_get_projects(self):
228 228
         """Test retrieving project list."""
229 229
         with mock.patch('openstack.connection.Connection') as MockClass:
230 230
             MockClass.return_value = MockedOpenStackConn()
231 231
             projects = self.osu.get_projects()
232
-            self.assertEquals(len(projects), 5)
232
+            self.assertEqual(len(projects), 5)
233 233
 
234 234
     def test_get_project(self):
235 235
         """Test retrieving project dict."""
236 236
         with mock.patch('openstack.connection.Connection') as MockClass:
237 237
             MockClass.return_value = MockedOpenStackConn()
238 238
             project = self.osu.get_project(project_id='12345')
239
-            self.assertEquals(project['id'], '12345')
240
-            self.assertEquals(project['name'], 'test_12345')
239
+            self.assertEqual(project['id'], '12345')
240
+            self.assertEqual(project['name'], 'test_12345')
241 241
 
242 242
     def test_get_project_name(self):
243 243
         """Test retrieving project name."""
244 244
         with mock.patch('openstack.connection.Connection') as MockClass:
245 245
             MockClass.return_value = MockedOpenStackConn()
246 246
             project_name = self.osu.get_project_name(project_id='12345')
247
-            self.assertEquals(project_name, 'test_12345')
247
+            self.assertEqual(project_name, 'test_12345')
248 248
 
249 249
     def test_get_flavors(self):
250 250
         """Test retrieving flavors dict."""
251 251
         with mock.patch('openstack.connection.Connection') as MockClass:
252 252
             MockClass.return_value = MockedOpenStackConn()
253 253
             servers = self.osu.get_flavors()
254
-            self.assertEquals(len(servers), 5)
254
+            self.assertEqual(len(servers), 5)
255 255
 
256 256
     def test_get_flavor(self):
257 257
         """Test retrieving flavor dict."""
258 258
         with mock.patch('openstack.connection.Connection') as MockClass:
259 259
             MockClass.return_value = MockedOpenStackConn()
260 260
             flavor = self.osu.get_flavor(flavor_id=12345)
261
-            self.assertEquals(flavor['id'], 12345)
262
-            self.assertEquals(flavor['name'], 'test_12345')
261
+            self.assertEqual(flavor['id'], 12345)
262
+            self.assertEqual(flavor['name'], 'test_12345')
263 263
 
264 264
     def test_get_flavor_name(self):
265 265
         """Test retrieving flavor name."""
266 266
         with mock.patch('openstack.connection.Connection') as MockClass:
267 267
             MockClass.return_value = MockedOpenStackConn()
268 268
             flavor_name = self.osu.get_flavor_name(flavor_id=12345)
269
-            self.assertEquals(flavor_name, 'test_12345')
269
+            self.assertEqual(flavor_name, 'test_12345')
270 270
 
271 271
     def test_get_volume_pool_stats(self):
272 272
         """Test retrieving block pool stats."""
@@ -274,7 +274,7 @@ class TestOsUtils(unittest.TestCase):
274 274
             MockClass.return_value = MockedOpenStackConn()
275 275
             limits = self.osu.get_volume_pool_stats()
276 276
             u = 'https://127.0.1.1/scheduler-stats/get_pools?detail=True'
277
-            self.assertEquals(limits, {'url': u})
277
+            self.assertEqual(limits, {'url': u})
278 278
 
279 279
     def test_get_volume_pool_stats_interface_set(self):
280 280
         """Test retrieving block pool stats."""
@@ -282,4 +282,4 @@ class TestOsUtils(unittest.TestCase):
282 282
             MockClass.return_value = MockedOpenStackConn()
283 283
             limits = self.osu.get_volume_pool_stats(interface='test')
284 284
             u = 'https://127.0.1.1/scheduler-stats/get_pools?detail=True'
285
-            self.assertEquals(limits, {'url': u})
285
+            self.assertEqual(limits, {'url': u})

+ 1
- 1
tests/unit/test_utils.py View File

@@ -143,7 +143,7 @@ class TestUtils(unittest.TestCase):
143 143
                 raise BaseException
144 144
 
145 145
         self.count = 0
146
-        self.assertEquals(_success(), True)
146
+        self.assertEqual(_success(), True)
147 147
 
148 148
     def test_log_exception(self):
149 149
         """Test traceback formatter for exception messages."""

Loading…
Cancel
Save