@@ 1755-1769 (lines=15) @@ | ||
1752 | assert response.status_code == 400 |
|
1753 | assert self.napp.handle_on_interface_tags.call_count == 0 |
|
1754 | ||
1755 | async def test_delete_tag_range(self): |
|
1756 | """Test delete_tag_range""" |
|
1757 | self.napp.controller.loop = asyncio.get_running_loop() |
|
1758 | interface_id = '00:00:00:00:00:00:00:01:1' |
|
1759 | dpid = '00:00:00:00:00:00:00:01' |
|
1760 | mock_switch = get_switch_mock(dpid) |
|
1761 | mock_interface = get_interface_mock('s1-eth1', 1, mock_switch) |
|
1762 | mock_interface.remove_tag_ranges = MagicMock() |
|
1763 | self.napp.handle_on_interface_tags = MagicMock() |
|
1764 | self.napp.controller.get_interface_by_id = MagicMock() |
|
1765 | self.napp.controller.get_interface_by_id.return_value = mock_interface |
|
1766 | url = f"{self.base_endpoint}/interfaces/{interface_id}/tag_ranges" |
|
1767 | response = await self.api_client.delete(url) |
|
1768 | assert response.status_code == 200 |
|
1769 | assert mock_interface.remove_tag_ranges.call_count == 1 |
|
1770 | ||
1771 | async def test_delete_tag_range_not_found(self): |
|
1772 | """Test delete_tag_range. Not found""" |
|
@@ 1771-1784 (lines=14) @@ | ||
1768 | assert response.status_code == 200 |
|
1769 | assert mock_interface.remove_tag_ranges.call_count == 1 |
|
1770 | ||
1771 | async def test_delete_tag_range_not_found(self): |
|
1772 | """Test delete_tag_range. Not found""" |
|
1773 | self.napp.controller.loop = asyncio.get_running_loop() |
|
1774 | interface_id = '00:00:00:00:00:00:00:01:1' |
|
1775 | dpid = '00:00:00:00:00:00:00:01' |
|
1776 | mock_switch = get_switch_mock(dpid) |
|
1777 | mock_interface = get_interface_mock('s1-eth1', 1, mock_switch) |
|
1778 | mock_interface.remove_tag_ranges = MagicMock() |
|
1779 | self.napp.controller.get_interface_by_id = MagicMock() |
|
1780 | self.napp.controller.get_interface_by_id.return_value = None |
|
1781 | url = f"{self.base_endpoint}/interfaces/{interface_id}/tag_ranges" |
|
1782 | response = await self.api_client.delete(url) |
|
1783 | assert response.status_code == 404 |
|
1784 | assert mock_interface.remove_tag_ranges.call_count == 0 |
|
1785 | ||
1786 | async def test_delete_tag_range_type_error(self): |
|
1787 | """Test delete_tag_range TagRangeError""" |