# Copyright (c) 2015, InfluxFramework LLC
# See license.txt

import unittest

import influxframework

test_records = influxframework.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 = influxframework._dict(args)

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

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