Code Duplication    Length = 15-15 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 126-140 (lines=15) @@
123
124
        assert response.data == b"Flow does not exist"
125
126
    @patch("napps.amlight.flow_stats.main.Main.flow_from_id")
127
    def test_bytes_count(self, mock_from_flow):
128
        """Test bytes_count rest call."""
129
        flow_id = '1'
130
        dpid_id = '1'
131
        mock_from_flow.return_value = self._get_mocked_flow_base()
132
133
        rest_name = "bytes_count"
134
        self._patch_switch_flow(flow_id)
135
136
        response = self._get_rest_response(rest_name, dpid_id)
137
        json_response = json.loads(response.data)
138
        assert json_response["flow_id"] == flow_id
139
        assert json_response["bytes_counter"] == 10
140
        assert json_response["bits_per_second"] == 4.0
141
142
    @patch("napps.amlight.flow_stats.main.Main.flow_stats_by_dpid_flow_id")
143
    def test_packet_count_per_flow(self, mock_from_flow):
@@ 102-116 (lines=15) @@
99
100
        assert response.data == b"Flow does not exist"
101
102
    @patch("napps.amlight.flow_stats.main.Main.flow_from_id")
103
    def test_packet_count(self, mock_from_flow):
104
        """Test packet_count rest call."""
105
        flow_id = '1'
106
        dpid_id = '1'
107
        mock_from_flow.return_value = self._get_mocked_flow_base()
108
109
        rest_name = "packet_count"
110
        self._patch_switch_flow(flow_id)
111
112
        response = self._get_rest_response(rest_name, dpid_id)
113
        json_response = json.loads(response.data)
114
        assert json_response["flow_id"] == flow_id
115
        assert json_response["packet_counter"] == 40
116
        assert json_response["packet_per_second"] == 2.0
117
118
    def test_bytes_count__fail(self):
119
        """Test bytes_count rest call with wrong flow_id."""