From 4a7e2c1e2f1b1dd2b27e71a67b53b2eb0aa66359 Mon Sep 17 00:00:00 2001 From: scmmishra Date: Wed, 6 Mar 2019 15:19:02 +0530 Subject: [PATCH] feat: Minor changes to topic tests --- erpnext/education/doctype/topic/test_topic.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/education/doctype/topic/test_topic.py b/erpnext/education/doctype/topic/test_topic.py index b014836228..d03db1cb93 100644 --- a/erpnext/education/doctype/topic/test_topic.py +++ b/erpnext/education/doctype/topic/test_topic.py @@ -12,18 +12,20 @@ class TestTopic(unittest.TestCase): def test_get_contents(self): topic = frappe.get_doc("Topic", "_Test Topic 1") - self.assertEqual(topic.name, "_Test Topic 1") contents = topic.get_contents() self.assertEqual(contents[0].doctype, "Article") self.assertEqual(contents[0].name, "_Test Article 1") frappe.db.rollback() def make_topic(name): - topic = frappe.get_doc({ - "doctype": "Topic", - "topic_name": name, - "topic_code": name, - }).insert() + try: + topic = frappe.get_doc("Topic", name) + except frappe.DoesNotExistError: + topic = frappe.get_doc({ + "doctype": "Topic", + "topic_name": name, + "topic_code": name, + }).insert() return topic.name def make_topic_and_linked_content(topic_name, content_dict_list):