def testDiskSpecs(self):
     s = """
 [{
     "ip_address": "174.12.14.1",
     "user_name": "ubuntu",
     "keyfile_path": "test_keyfile_path",
     "local_disks": ["/test_local_disk_0", "/test_local_disk_1"],
     "scratch_disk_mountpoints": ["/test_scratch_disk_0",
                                  "/test_scratch_disk_1"]
 }]
 """
     expected_paths_and_mount_points = ((None, '/test_scratch_disk_0'),
                                        (None, '/test_scratch_disk_1'),
                                        ('/test_local_disk_0', None),
                                        ('/test_local_disk_1', None))
     fp = StringIO(s)
     StaticVirtualMachine.ReadStaticVirtualMachineFile(fp)
     self.assertEqual(1, len(StaticVirtualMachine.vm_pool))
     vm = StaticVirtualMachine.GetStaticVirtualMachine()
     self.assertTrue(vm.from_pool)
     self.assertEqual(len(vm.disk_specs), 4)
     for disk_spec, expected_paths in zip(vm.disk_specs,
                                          expected_paths_and_mount_points):
         expected_device_path, expected_mount_point = expected_paths
         self.assertEqual(disk_spec.device_path, expected_device_path)
         self.assertEqual(disk_spec.mount_point, expected_mount_point)
 def testCreateReturn(self):
     s = ('[{'
          '  "ip_address": "174.12.14.1", '
          '  "user_name": "perfkitbenchmarker", '
          '  "keyfile_path": "perfkitbenchmarker.pem" '
          '}, '
          '{ '
          '   "ip_address": "174.12.14.121", '
          '   "user_name": "ubuntu", '
          '   "keyfile_path": "rackspace.pem", '
          '   "internal_ip": "10.10.10.2", '
          '   "zone": "rackspace_dallas" '
          '}] ')
     fp = StringIO(s)
     StaticVirtualMachine.ReadStaticVirtualMachineFile(fp)
     self.assertEqual(2, len(StaticVirtualMachine.vm_pool))
     vm0 = StaticVirtualMachine.GetStaticVirtualMachine()
     self.assertTrue(vm0.from_pool)
     self.assertEqual(1, len(StaticVirtualMachine.vm_pool))
     vm0.Delete()
     self.assertEqual(2, len(StaticVirtualMachine.vm_pool))
     vm1 = StaticVirtualMachine.GetStaticVirtualMachine()
     self.assertIs(vm0, vm1)