Code Duplication    Length = 14-14 lines in 2 locations

tests/unit/test_main.py 2 locations

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