def test_validate_subnet_no_conflicts(self):
     mock_client = MagicMock()
     mock_client.file_servers.get = MagicMock(
         return_value=FileServer(subnet=ResourceId(
             id='/subscriptions/000/resourceGroups/gr/providers/Microsoft.Network/virtualNetworks/vn/subnets/subnet')
         ))
     _verify_subnet(
         mock_client,
         '/subscriptions/000/resourceGroups/gr/providers/Microsoft.Network/virtualNetworks/vn/subnets/subnet',
         'mocknfs', 'mockrg')
 def test_validate_subnet_when_conflict(self):
     mock_client = MagicMock()
     mock_client.file_servers.get = MagicMock(
         return_value=FileServer(
             subnet=ResourceId(id='conflict')
         ))
     with self.assertRaisesRegexp(CLIError, 'Cluster and mounted NFS must be in the same subnet'):
         _verify_subnet(
             mock_client,
             '/subscriptions/000/resourceGroups/gr/providers/Microsoft.Network/virtualNetworks/vn/subnets/subnet',
             'mocknfs', 'mockrg')
 def test_validate_subnet_no_nfs(self):
     _verify_subnet(
         None,
         '/subscriptions/000/resourceGroups/gr/providers/Microsoft.Network/virtualNetworks/vn/subnets/subnet',
         None, 'mockgr')
 def test_validate_subnet_wrong_resource_id(self):
     with self.assertRaisesRegexp(CLIError, 'Ill-formed subnet resource id'):
         _verify_subnet(None, 'bla-bla', None, 'foo')
 def test_validate_subnet_no_subnet(self):
     _verify_subnet(None, None, 'mocknfs', 'mockgr')