fix(woocommerce integration): fixing 403 error

(cherry picked from commit 6784335e2ca3ea8883f08b3d94101f525f37bf1e)
diff --git a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
index 04accd9..f55a3b1 100644
--- a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
+++ b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
@@ -22,24 +22,20 @@
 	frappe.set_user(woocommerce_settings.modified_by)
 
 @frappe.whitelist(allow_guest=True)
-def order(data=None):
-	if not data:
-		verify_request()
+def order():
+	if frappe.flags.woocomm_test_order_data:
+		fd = frappe.flags.woocomm_test_order_data
+		event = "created"
 
-	if frappe.request and frappe.request.data:
+	elif frappe.request and frappe.request.data:
+		verify_request()
 		fd = json.loads(frappe.request.data)
-	elif data:
-		fd = data
+		event = frappe.get_request_header("X-Wc-Webhook-Event")
+
 	else:
 		return "success"
 
-	if not data:
-		event = frappe.get_request_header("X-Wc-Webhook-Event")
-	else:
-		event = "created"
-
 	if event == "created":
-
 		raw_billing_data = fd.get("billing")
 		customer_woo_com_email = raw_billing_data.get("email")
 
@@ -100,7 +96,7 @@
 				"item_name": found_item.item_name,
 				"description": found_item.item_name,
 				"delivery_date":order_delivery_date,
-				"uom": "Nos",
+				"uom": _("Nos"),
 				"qty": item.get("quantity"),
 				"rate": item.get("price"),
 				"warehouse": "Stores" + " - " + company_abbr
@@ -189,6 +185,7 @@
 	item.item_code = "woocommerce - " + str(item_data.get("product_id"))
 	item.woocommerce_id = str(item_data.get("product_id"))
 	item.item_group = "WooCommerce Products"
+	item.stock_uom = _("Nos")
 	item.save()
 	frappe.db.commit()
 
@@ -209,4 +206,4 @@
 							"account_head": account_head_type,
 							"tax_amount": price,
 							"description": desc
-							})
\ No newline at end of file
+							})
diff --git a/erpnext/tests/test_woocommerce.py b/erpnext/tests/test_woocommerce.py
index 373d0a0..dbca56c 100644
--- a/erpnext/tests/test_woocommerce.py
+++ b/erpnext/tests/test_woocommerce.py
@@ -23,12 +23,13 @@
 			woo_settings.save(ignore_permissions=True)
 
 	def test_sales_order_for_woocommerece(self):
-		data = {"id":75,"parent_id":0,"number":"74","order_key":"wc_order_5aa1281c2dacb","created_via":"checkout","version":"3.3.3","status":"processing","currency":"INR","date_created":"2018-03-08T12:10:04","date_created_gmt":"2018-03-08T12:10:04","date_modified":"2018-03-08T12:10:04","date_modified_gmt":"2018-03-08T12:10:04","discount_total":"0.00","discount_tax":"0.00","shipping_total":"150.00","shipping_tax":"0.00","cart_tax":"0.00","total":"649.00","total_tax":"0.00","prices_include_tax":False,"customer_id":12,"customer_ip_address":"103.54.99.5","customer_user_agent":"mozilla\\/5.0 (x11; linux x86_64) applewebkit\\/537.36 (khtml, like gecko) chrome\\/64.0.3282.186 safari\\/537.36","customer_note":"","billing":{"first_name":"Tony","last_name":"Stark","company":"Woocommerce","address_1":"Mumbai","address_2":"","city":"Dadar","state":"MH","postcode":"123","country":"IN","email":"tony@gmail.com","phone":"123457890"},"shipping":{"first_name":"Tony","last_name":"Stark","company":"","address_1":"Mumbai","address_2":"","city":"Dadar","state":"MH","postcode":"123","country":"IN"},"payment_method":"cod","payment_method_title":"Cash on delivery","transaction_id":"","date_paid":"","date_paid_gmt":"","date_completed":"","date_completed_gmt":"","cart_hash":"8e76b020d5790066496f244860c4703f","meta_data":[],"line_items":[{"id":80,"name":"Marvel","product_id":56,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"499.00","subtotal_tax":"0.00","total":"499.00","total_tax":"0.00","taxes":[],"meta_data":[],"sku":"","price":499}],"tax_lines":[],"shipping_lines":[{"id":81,"method_title":"Flat rate","method_id":"flat_rate:1","total":"150.00","total_tax":"0.00","taxes":[],"meta_data":[{"id":623,"key":"Items","value":"Marvel × 1"}]}],"fee_lines":[],"coupon_lines":[],"refunds":[]}
-		order(data)
+		frappe.flags.woocomm_test_order_data = {"id":75,"parent_id":0,"number":"74","order_key":"wc_order_5aa1281c2dacb","created_via":"checkout","version":"3.3.3","status":"processing","currency":"INR","date_created":"2018-03-08T12:10:04","date_created_gmt":"2018-03-08T12:10:04","date_modified":"2018-03-08T12:10:04","date_modified_gmt":"2018-03-08T12:10:04","discount_total":"0.00","discount_tax":"0.00","shipping_total":"150.00","shipping_tax":"0.00","cart_tax":"0.00","total":"649.00","total_tax":"0.00","prices_include_tax":False,"customer_id":12,"customer_ip_address":"103.54.99.5","customer_user_agent":"mozilla\\/5.0 (x11; linux x86_64) applewebkit\\/537.36 (khtml, like gecko) chrome\\/64.0.3282.186 safari\\/537.36","customer_note":"","billing":{"first_name":"Tony","last_name":"Stark","company":"Woocommerce","address_1":"Mumbai","address_2":"","city":"Dadar","state":"MH","postcode":"123","country":"IN","email":"tony@gmail.com","phone":"123457890"},"shipping":{"first_name":"Tony","last_name":"Stark","company":"","address_1":"Mumbai","address_2":"","city":"Dadar","state":"MH","postcode":"123","country":"IN"},"payment_method":"cod","payment_method_title":"Cash on delivery","transaction_id":"","date_paid":"","date_paid_gmt":"","date_completed":"","date_completed_gmt":"","cart_hash":"8e76b020d5790066496f244860c4703f","meta_data":[],"line_items":[{"id":80,"name":"Marvel","product_id":56,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"499.00","subtotal_tax":"0.00","total":"499.00","total_tax":"0.00","taxes":[],"meta_data":[],"sku":"","price":499}],"tax_lines":[],"shipping_lines":[{"id":81,"method_title":"Flat rate","method_id":"flat_rate:1","total":"150.00","total_tax":"0.00","taxes":[],"meta_data":[{"id":623,"key":"Items","value":"Marvel × 1"}]}],"fee_lines":[],"coupon_lines":[],"refunds":[]}
+		order()
 
 		self.assertTrue(frappe.get_value("Customer",{"woocommerce_email":"tony@gmail.com"}))
 		self.assertTrue(frappe.get_value("Item",{"woocommerce_id": 56}))
 		self.assertTrue(frappe.get_value("Sales Order",{"woocommerce_id":75}))
+		frappe.flags.woocomm_test_order_data = {}
 
 def emulate_request():
 	# Emulate Woocommerce Request
@@ -52,4 +53,4 @@
 	r = requests.post(url=url, headers=headers, data=data)
 
 	time.sleep(5)
-	return r
\ No newline at end of file
+	return r