main_test.go 808 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package main
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "youngee_b_api/config"
  7. "youngee_b_api/db"
  8. "youngee_b_api/model/http_model"
  9. "youngee_b_api/service"
  10. )
  11. func TestGormUser(t *testing.T) {
  12. ctx := context.Background()
  13. config.Init()
  14. res, err := db.GetUserByPhone(ctx, "15010101010")
  15. if err != nil {
  16. panic(err)
  17. } else {
  18. fmt.Printf("%+v\n", res)
  19. }
  20. }
  21. func TestDbCreateEnterprise(t *testing.T) {
  22. ctx := context.Background()
  23. config.Init()
  24. newEnterprise := http_model.CreateEnterpriseRequest{
  25. Industry: 2,
  26. BusinessName: "Test公司",
  27. RealName: "测试员",
  28. Phone: "13010101010",
  29. Email: "test@younggee.com",
  30. }
  31. res := service.CreateEnterprise.CreateEnterpriseUser(ctx, newEnterprise)
  32. if res != nil {
  33. fmt.Printf("%+v\n", res)
  34. } else {
  35. fmt.Printf("error\n")
  36. }
  37. }