Code Duplication    Length = 22-24 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 2348-2371 (lines=24) @@
2345
        self.napp.handle_flow_delete(event)
2346
        evc.set_flow_removed_at.assert_called_once()
2347
2348
    async def test_add_bulk_metadata(self):
2349
        """Test add_bulk_metadata method"""
2350
        self.napp.controller.loop = asyncio.get_running_loop()
2351
        evc_mock = create_autospec(EVC)
2352
        evc_mock.id = 1234
2353
        self.napp.circuits = {"1234": evc_mock}
2354
        payload = {
2355
            "circuit_ids": ["1234"],
2356
            "metadata1": 1,
2357
            "metadata2": 2
2358
        }
2359
        response = await self.api_client.post(
2360
            f"{self.base_endpoint}/v2/evc/metadata",
2361
            json=payload
2362
        )
2363
        assert response.status_code == 201
2364
        args = self.napp.mongo_controller.update_evcs_metadata.call_args[0]
2365
        ids = payload.pop("circuit_ids")
2366
        assert args[0] == ids
2367
        assert args[1] == payload
2368
        assert args[2] == "add"
2369
        calls = self.napp.mongo_controller.update_evcs_metadata.call_count
2370
        assert calls == 1
2371
        evc_mock.extend_metadata.assert_called_with(payload)
2372
2373
    async def test_add_bulk_metadata_empty_list(self):
2374
        """Test add_bulk_metadata method empty list"""
@@ 2421-2442 (lines=22) @@
2418
        )
2419
        assert response.status_code == 400
2420
2421
    async def test_delete_bulk_metadata(self):
2422
        """Test delete_metadata method"""
2423
        self.napp.controller.loop = asyncio.get_running_loop()
2424
        evc_mock = create_autospec(EVC)
2425
        evc_mock.id = 1234
2426
        self.napp.circuits = {"1234": evc_mock}
2427
        payload = {
2428
            "circuit_ids": ["1234"]
2429
        }
2430
        response = await self.api_client.request(
2431
            "DELETE",
2432
            f"{self.base_endpoint}/v2/evc/metadata/metadata1",
2433
            json=payload
2434
        )
2435
        assert response.status_code == 200
2436
        args = self.napp.mongo_controller.update_evcs_metadata.call_args[0]
2437
        assert args[0] == payload["circuit_ids"]
2438
        assert args[1] == {"metadata1": ""}
2439
        assert args[2] == "del"
2440
        calls = self.napp.mongo_controller.update_evcs_metadata.call_count
2441
        assert calls == 1
2442
        assert evc_mock.remove_metadata.call_count == 1
2443
2444
    async def test_delete_bulk_metadata_error(self):
2445
        """Test bulk_delete_metadata with ciruit erroring"""