Code Duplication    Length = 19-21 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 331-351 (lines=21) @@
328
        expected = table_by_sw
329
        assert response.json() == expected
330
331
    @patch("napps.amlight.kytos_stats.main.Main.table_stats_by_dpid_table_id")
332
    async def test_table_stats_by_dpid_table_id_without_dpid(self,
333
                                                             mock_from_table):
334
        """Test table_stats rest call."""
335
        table_info = {
336
            "table_id": 10,
337
            "active_count": 20,
338
            "lookup_count": 30,
339
            "matched_count": 32768
340
            }
341
        table_stats_dict_mock = {'10': table_info}
342
        table_by_sw = {"00:00:00:00:00:00:00:01": table_stats_dict_mock}
343
        mock_from_table.return_value = table_by_sw
344
345
        endpoint = "/table/stats"
346
        url = f"{self.base_endpoint}{endpoint}"
347
        response = await self.api_client.get(url)
348
        assert response.status_code == 200
349
350
        expected = table_by_sw
351
        assert response.json() == expected
352
353
    @patch("napps.amlight.kytos_stats.main.Main.table_stats_by_dpid_table_id")
354
    async def test_table_stats_by_dpid_table_id_not_found(self,
@@ 311-329 (lines=19) @@
308
        assert response.status_code == 200
309
        assert len(response.json()) == 0
310
311
    @patch("napps.amlight.kytos_stats.main.Main.table_stats_by_dpid_table_id")
312
    async def test_table_stats_by_dpid_table_id(self, mock_from_table):
313
        """Test table_stats rest call."""
314
        table_info = {
315
            "table_id": 10,
316
            "active_count": 20,
317
            "lookup_count": 30,
318
            "matched_count": 32768
319
            }
320
        table_stats_dict_mock = {'10': table_info}
321
        table_by_sw = {"00:00:00:00:00:00:00:01": table_stats_dict_mock}
322
        mock_from_table.return_value = table_by_sw
323
324
        endpoint = "/table/stats?dpid=00:00:00:00:00:00:00:01&table=10"
325
        url = f"{self.base_endpoint}{endpoint}"
326
        response = await self.api_client.get(url)
327
        assert response.status_code == 200
328
        expected = table_by_sw
329
        assert response.json() == expected
330
331
    @patch("napps.amlight.kytos_stats.main.Main.table_stats_by_dpid_table_id")
332
    async def test_table_stats_by_dpid_table_id_without_dpid(self,