{
  "output": "Successfully created and wrote to new file: /Users/bob/git/dxw/aws-stuff/tests/test_vpc.py. Here is the updated code:\nimport unittest\nfrom unittest.mock import MagicMock, patch\nfrom audits.vpc import fetch_vpcs, get_vpc_name\n\nclass TestVpcAudit(unittest.TestCase):\n    def test_get_vpc_name(self):\n        tags = [{\"Key\": \"Name\", \"Value\": \"MyVPC\"}]\n        self.assertEqual(get_vpc_name(tags), \"MyVPC\")\n        \n        tags_no_name = [{\"Key\": \"Environment\", \"Value\": \"Prod\"}]\n        self.assertEqual(get_vpc_name(tags_no_name), \"Unnamed VPC\")\n        \n        self.assertEqual(get_vpc_name([]), \"Unnamed VPC\")\n        self.assertEqual(get_vpc_name(None), \"Unnamed VPC\")\n\n    def test_fetch_vpcs(self):\n        # Mock EC2 client and paginator\n        mock_ec2 = MagicMock()\n        mock_paginator = MagicMock()\n        mock_ec2.get_paginator.return_value = mock_paginator\n        \n        # Mock the response from describe_vpcs\n        mock_paginator.paginate.return_value = [\n            {\n                \"Vpcs\": [\n                    {\n                        \"VpcId\": \"vpc-123\",\n                        \"CidrBlock\": \"10.0.0.0/16\",\n                        \"Tags\": [{\"Key\": \"Name\", \"Value\": \"TestVPC\"}]\n                    },\n                    {\n                        \"VpcId\": \"vpc-456\",\n                        \"CidrBlock\": \"192.168.0.0/24\"\n                        # No Name tag\n                    }\n                ]\n            }\n        ]\n        \n        vpcs = fetch_vpcs(mock_ec2)\n        \n        self.assertEqual(len(vpcs), 2)\n        self.assertEqual(vpcs[0][\"VPCName\"], \"TestVPC\")\n        self.assertEqual(vpcs[0][\"VPCID\"], \"vpc-123\")\n        self.assertEqual(vpcs[0][\"CIDRBlock\"], \"10.0.0.0/16\")\n        \n        self.assertEqual(vpcs[1][\"VPCName\"], \"Unnamed VPC\")\n        self.assertEqual(vpcs[1][\"VPCID\"], \"vpc-456\")\n        self.assertEqual(vpcs[1][\"CIDRBlock\"], \"192.168.0.0/24\")\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
}