package feie

import (
	"testing"

	"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"

	"git.rosy.net.cn/baseapi/utils"

	"git.rosy.net.cn/jx-callback/business/partner"

	_ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
	_ "git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/defsch"
	"git.rosy.net.cn/jx-callback/globals/testinit"
)

func init() {
	testinit.Init()
}

func TestPrintMsg(t *testing.T) {
	orderID := "910838879000442"
	vendorID := 0
	order, err := partner.CurOrderManager.LoadOrder(orderID, vendorID)
	if err != nil {
		t.Fatal(err)
	}

	context := CurPrinterHandler.getOrderContent(order, "13412345678", nil)
	//context := CurPrinterHandler.getOrderContentBig(order, "13412345678")
	status, err := CurPrinterHandler.PrintMsg(jxcontext.AdminCtx, "218510310", "ztdpveyg", "test", context)
	t.Log(utils.Format4Output(status, false))
	if err != nil {
		t.Fatal(err)
	}
}

func TestRegisterPrinter(t *testing.T) {
	newID1, newID2, err := CurPrinterHandler.RegisterPrinter(jxcontext.AdminCtx, "218510310", "ztdpveyg", "title", 1)
	t.Log(newID1 + "," + newID2)
	if err != nil {
		t.Fatal(err)
	}
}

func TestGetPrinterStatus(t *testing.T) {
	sn, err := CurPrinterHandler.GetPrinterStatus(nil, "525553025", "BIXCwxea")
	t.Log(sn)
	if err != nil {
		t.Fatal(err)
	}
}
