Example #1
0
    def test_create_vm(self):
        """
        It should create a VM
        """
        self.assertIsInstance(platform.create_vm(), vm.VM)

        with patch('v8cffi.platform.vm.VM', autospec=True) as r:
            r.return_value = None
            platform.create_vm()
            r.assert_called_once_with(platform)
Example #2
0
    def test_create_vm(self):
        """
        It should create a VM
        """
        self.assertIsInstance(platform.create_vm(), vm.VM)

        with patch('v8cffi.platform.vm.VM', autospec=True) as r:
            r.return_value = None
            platform.create_vm()
            r.assert_called_once_with(platform)
Example #3
0
    def test_get_context(self):
        """
        It should return the global context
        """
        self.assertRaises(AssertionError, shortcuts.get_context)

        shortcuts._context = (platform.create_vm().create_context())

        self.assertEqual(shortcuts._context, shortcuts.get_context())
Example #4
0
    def test_set_up_set_up(self):
        """
        It should not allow to re set up
        """
        shortcuts._context = (platform.create_vm().create_context())

        with patch('v8cffi.shortcuts.platform', autospec=True) as rp:
            rp.set_up = Mock()
            self.assertRaises(AssertionError, shortcuts.set_up)
            self.assertFalse(rp.set_up.called)