Code Duplication    Length = 15-15 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 157-171 (lines=15) @@
154
155
        assert response.data == b"Flow does not exist"
156
157
    @patch("napps.amlight.flow_stats.main.Main.flow_from_id")
158
    def test_bytes_count(self, mock_from_flow):
159
        """Test bytes_count rest call."""
160
        flow_id = '1'
161
        dpid_id = '1'
162
        mock_from_flow.return_value = self._get_mocked_flow_base()
163
164
        rest_name = "bytes_count"
165
        self._patch_switch_flow(flow_id)
166
167
        response = self._get_rest_response(rest_name, dpid_id)
168
        json_response = json.loads(response.data)
169
        assert json_response["flow_id"] == flow_id
170
        assert json_response["bytes_counter"] == 10
171
        assert json_response["bits_per_second"] == 4.0
172
173
    def test_packet_count_per_flow__empty(self):
174
        """Test packet_count rest call with a flow that does not exist ."""
@@ 133-147 (lines=15) @@
130
131
        assert response.data == b"Flow does not exist"
132
133
    @patch("napps.amlight.flow_stats.main.Main.flow_from_id")
134
    def test_packet_count(self, mock_from_flow):
135
        """Test packet_count rest call."""
136
        flow_id = '1'
137
        dpid_id = '1'
138
        mock_from_flow.return_value = self._get_mocked_flow_base()
139
140
        rest_name = "packet_count"
141
        self._patch_switch_flow(flow_id)
142
143
        response = self._get_rest_response(rest_name, dpid_id)
144
        json_response = json.loads(response.data)
145
        assert json_response["flow_id"] == flow_id
146
        assert json_response["packet_counter"] == 40
147
        assert json_response["packet_per_second"] == 2.0
148
149
    def test_bytes_count__fail(self):
150
        """Test bytes_count rest call with wrong flow_id."""