Code Duplication    Length = 14-14 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 95-108 (lines=14) @@
92
        assert response.status_code == 404
93
        assert response.json()["description"] == "Flow does not exist"
94
95
    @patch("napps.amlight.kytos_stats.main.Main.flow_from_id")
96
    async def test_bytes_count(self, mock_from_flow):
97
        """Test bytes_count rest call."""
98
        flow_id = '1'
99
        mock_from_flow.return_value = self._get_mocked_flow_base()
100
        self._patch_switch_flow(flow_id)
101
102
        endpoint = f"{self.base_endpoint}/bytes_count/{flow_id}"
103
        response = await self.api_client.get(endpoint)
104
        assert response.status_code == 200
105
        json_response = response.json()
106
        assert json_response["flow_id"] == flow_id
107
        assert json_response["bytes_counter"] == 10
108
        assert json_response["bits_per_second"] == 4.0
109
110
    async def test_packet_count_per_flow_empty(self):
111
        """Test packet_count rest call with a flow that does not exist ."""
@@ 72-85 (lines=14) @@
69
        assert response.status_code == 404
70
        assert response.json()["description"] == "Flow does not exist"
71
72
    @patch("napps.amlight.kytos_stats.main.Main.flow_from_id")
73
    async def test_packet_count(self, mock_from_flow):
74
        """Test packet_count rest call."""
75
        flow_id = '1'
76
        mock_from_flow.return_value = self._get_mocked_flow_base()
77
78
        self._patch_switch_flow(flow_id)
79
        endpoint = f"{self.base_endpoint}/packet_count/{flow_id}"
80
        response = await self.api_client.get(endpoint)
81
        assert response.status_code == 200
82
        json_response = response.json()
83
        assert json_response["flow_id"] == flow_id
84
        assert json_response["packet_counter"] == 40
85
        assert json_response["packet_per_second"] == 2.0
86
87
    async def test_bytes_count_not_found(self):
88
        """Test bytes_count rest call with wrong flow_id."""