Exemplo n.º 1
0
    def test_quota_commit_task(self, mock_quota_commit):
        """Test checks commits the reservation."""
        mock_reservations = mock.MagicMock()
        mock_snapshot_properties = mock.MagicMock()
        mock_optional_args = mock.MagicMock()

        task = manager.QuotaCommitTask()
        task.execute(self.ctxt, mock_reservations, mock_snapshot_properties,
                     mock_optional_args)
        mock_quota_commit.assert_called_once_with(self.ctxt, mock_reservations)
Exemplo n.º 2
0
    def test_quota_commit_revert_task(self, mock_quota_reserve):
        """Test checks commits the reservation."""
        mock_result = mock.MagicMock()
        expected_snapshot = mock_result['snapshot_properties']
        expected_gigabyte = -expected_snapshot['volume_size']

        task = manager.QuotaCommitTask()
        task.revert(self.ctxt, mock_result)
        mock_quota_reserve.assert_called_once_with(self.ctxt,
                                                   gigabytes=expected_gigabyte,
                                                   project_id=None,
                                                   snapshots=-1)