# Copyright (c) 2015, SolutionERP LLC and Contributors
# See license.txt

import unittest

import xhiveframework

test_records = xhiveframework.get_test_records("Operation")


class TestOperation(unittest.TestCase):
	pass


def make_operation(*args, **kwargs):
	args = args if args else kwargs
	if isinstance(args, tuple):
		args = args[0]

	args = xhiveframework._dict(args)

	if not xhiveframework.db.exists("Operation", args.operation):
		doc = xhiveframework.get_doc(
			{"doctype": "Operation", "name": args.operation, "workstation": args.workstation}
		)
		doc.insert()
		return doc

	return xhiveframework.get_doc("Operation", args.operation)
