Code Duplication    Length = 19-21 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 312-330 (lines=19) @@
309
        assert response.status_code == 200
310
        assert len(response.json()) == 0
311
312
    @patch("napps.amlight.kytos_stats.main.Main.table_stats_by_dpid_table_id")
313
    async def test_table_stats_by_dpid_table_id(self, mock_from_table):
314
        """Test table_stats rest call."""
315
        table_info = {
316
            "table_id": 10,
317
            "active_count": 20,
318
            "lookup_count": 30,
319
            "matched_count": 32768
320
            }
321
        table_stats_dict_mock = {'10': table_info}
322
        table_by_sw = {"00:00:00:00:00:00:00:01": table_stats_dict_mock}
323
        mock_from_table.return_value = table_by_sw
324
325
        endpoint = "/table/stats?dpid=00:00:00:00:00:00:00:01&table=10"
326
        url = f"{self.base_endpoint}{endpoint}"
327
        response = await self.api_client.get(url)
328
        assert response.status_code == 200
329
        expected = table_by_sw
330
        assert response.json() == expected
331
332
    async def test_port_stats_filter(self):
333
        """Test table_stats rest call."""
@@ 421-441 (lines=21) @@
418
419
        assert self.napp.port_stats_dict == expected_dict
420
421
    @patch("napps.amlight.kytos_stats.main.Main.table_stats_by_dpid_table_id")
422
    async def test_table_stats_by_dpid_table_id_without_dpid(self,
423
                                                             mock_from_table):
424
        """Test table_stats rest call."""
425
        table_info = {
426
            "table_id": 10,
427
            "active_count": 20,
428
            "lookup_count": 30,
429
            "matched_count": 32768
430
            }
431
        table_stats_dict_mock = {'10': table_info}
432
        table_by_sw = {"00:00:00:00:00:00:00:01": table_stats_dict_mock}
433
        mock_from_table.return_value = table_by_sw
434
435
        endpoint = "/table/stats"
436
        url = f"{self.base_endpoint}{endpoint}"
437
        response = await self.api_client.get(url)
438
        assert response.status_code == 200
439
440
        expected = table_by_sw
441
        assert response.json() == expected
442
443
    @patch("napps.amlight.kytos_stats.main.Main.table_stats_by_dpid_table_id")
444
    async def test_table_stats_by_dpid_table_id_not_found(self,