This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
impl_test.go
139 lines (128 loc) · 17.6 KB
/
impl_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package jw_scraper_test
import (
"github.com/QSCTech/jw-scraper"
"github.com/joho/godotenv"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"log"
"net/http"
"os"
"testing"
)
func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
}
func TestHttpService_GetLoginPage(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
page, err := server.GetLoginPage()
assert.Nil(t, err)
assert.NotZero(t, page)
}
func TestHttpService_Login(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
jwbCookie, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fSjITNzcKuKXEUyXg=")
assert.Nil(t, err)
assert.NotZero(t, jwbCookie)
}
func TestHttpService_Login_Fail(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
_, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_WRONG_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fSjITNzcKuKXEUyXg=")
assert.NotNil(t, err)
stat, ok := status.FromError(err)
assert.True(t, ok)
assert.Equal(t, codes.InvalidArgument, stat.Code())
}
func TestHttpService_GetDefaultCourses(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
jwbCookie, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fSjITNzcKuKXEUyXg=")
assert.Nil(t, err)
page, statusCode, err := server.GetDefaultCourses(os.Getenv("TEST_STU_ID"), jwbCookie)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, statusCode)
assert.NotZero(t, page)
}
func TestHttpService_GetCourses(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
jwbCookie, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fSjITNzcKuKXEUyXg=")
assert.Nil(t, err)
page, statusCode, err := server.GetCourses(
os.Getenv("TEST_STU_ID"),
jwbCookie,
"2018-2019",
"1|秋、冬",
"dDwtMjQ5Nzk5MzUyO3Q8O2w8aTwwPjs+O2w8dDw7bDxpPDE+O2k8Mz47aTw1PjtpPDg+O2k8MTA+O2k8MTI+O2k8MTQ+O2k8MTY+O2k8MTg+O2k8MjI+O2k8MjY+O2k8Mjg+Oz47bDx0PHQ8OztsPGk8MD47Pj47Oz47dDx0PHA8cDxsPERhdGFUZXh0RmllbGQ7RGF0YVZhbHVlRmllbGQ7PjtsPHhuO3huOz4+Oz47dDxpPDM+O0A8MjAxOC0yMDE5OzIwMTctMjAxODsyMDE2LTIwMTc7PjtAPDIwMTgtMjAxOTsyMDE3LTIwMTg7MjAxNi0yMDE3Oz4+O2w8aTwwPjs+Pjs7Pjt0PHQ8cDxwPGw8RGF0YVRleHRGaWVsZDtEYXRhVmFsdWVGaWVsZDs+O2w8ZHl4cTt4cTE7Pj47Pjt0PGk8Mj47QDzmmKXjgIHlpI8756eL44CB5YasOz47QDwyfOaYpe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bDwxOz4+Oz47Oz47Pj47Pj47Pj47dDxAMDxwPHA8bDxQYWdlQ291bnQ7XyFJdGVtQ291bnQ7XyFEYXRhU291cmNlSXRlbUNvdW50O0RhdGFLZXlzOz47bDxpPDE+O2k8MD47aTwwPjtsPD47Pj47Pjs7Ozs7Ozs7Ozs+Ozs+O3Q8O2w8aTwzPjs+O2w8dDxAMDw7Ozs7Ozs7Ozs7Pjs7Pjs+Pjs+Pjs+Pjs+Alal0Mdy1EQJ38XRwfsObXeLLBw=",
"xqd",
)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, statusCode)
assert.NotZero(t, page)
}
func TestHttpServiceImpl_GetMajorScores(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
jwbCookie, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fSjITNzcKuKXEUyXg=")
assert.Nil(t, err)
page, statusCode, err := server.GetMajorScores(os.Getenv("TEST_STU_ID"), jwbCookie)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, statusCode)
assert.NotZero(t, page)
}
func TestHttpServiceImpl_GetScoresBase(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
jwbCookie, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fSjITNzcKuKXEUyXg=")
assert.Nil(t, err)
page, statusCode, err := server.GetScoresBase(os.Getenv("TEST_STU_ID"), jwbCookie)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, statusCode)
assert.NotZero(t, page)
}
func TestHttpServiceImpl_GetScores(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
jwbCookie, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fS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ensDvor77nqIvlkI3np7A7bzxmPjs+Pjs7Ozs+O0AwPHA8bDxIZWFkZXJUZXh0O0RhdGFGaWVsZDtTb3J0RXhwcmVzc2lvbjtSZWFkT25seTs+O2w85oiQ57upO+aIkOe7qTvmiJDnu6k7bzxmPjs+Pjs7Ozs+O0AwPHA8bDxIZWFkZXJUZXh0O0RhdGFGaWVsZDtTb3J0RXhwcmVzc2lvbjtSZWFkT25seTs+O2w85a2m5YiGO+WtpuWIhjvlrabliIY7bzxmPjs+Pjs7Ozs+O0AwPHA8bDxIZWFkZXJUZXh0O0RhdGFGaWVsZDtTb3J0RXhwcmVzc2lvbjtSZWFkT25seTs+O2w857up54K5O+e7qeeCuTvnu6nngrk7bzxmPjs+Pjs7Ozs+O0AwPHA8bDxIZWFkZXJUZXh0O0RhdGFGaWVsZDtTb3J0RXhwcmVzc2lvbjtSZWFkT25seTs+O2w86K+m57uG5L+h5oGvO+ivpue7huS/oeaBrzvor6bnu4bkv6Hmga87bzxmPjs+Pjs7Ozs+Oz47Pjs7Pjt0PEAwPHA8cDxsPFZpc2libGU7PjtsPG88dD47Pj47Pjs7Ozs7Ozs7Ozs+Ozs+O3Q8cDxwPGw8VGV4dDs+O2w8WkpEWDs+Pjs+Ozs+O3Q8cDxwPGw8SW1hZ2VVcmw7PjtsPC4vdHBtbC85NzA1MjcuanBnOz4+Oz47Oz47Pj47Pj47PgH4IFyjHVBGUcQRhLvgSseALZ98",
)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, statusCode)
assert.NotZero(t, page)
}
func TestHttpServiceImpl_GetTotalCredit(t *testing.T) {
server := jw_scraper.NewHttpService(os.Getenv("JW_BASE_URL"))
jwbCookie, err := server.Login(
os.Getenv("TEST_STU_ID"),
os.Getenv("TEST_PASSWORD"),
"dDwxNTc0MzA5MTU4Ozs+b5wKASjiu+fSjITNzcKuKXEUyXg=")
assert.Nil(t, err)
page, statusCode, err := server.GetTotalCredit(os.Getenv("TEST_STU_ID"), jwbCookie)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, statusCode)
assert.NotZero(t, page)
}