Documentation ¶
Index ¶
- Constants
- func GockRegisterAuthenticatedGet(endpoint string, file File) error
- func GockRegisterAuthenticatedGetWithParams(endpoint string, params map[string]string, file File) error
- func GockRegisterAuthenticatedPost(endpoint string, requestMatcher gock.MatchFunc, file File) error
- func GockRegisterCalendarEndpoint(start, end string, file File) error
- func GockRegisterCurrentCoursesPage() error
- func GockRegisterExamResultPage() error
- func GockRegisterExamResultRequest(semesterRef string) error
- func GockRegisterHomePageLoggedIn() error
- func GockRegisterLoginPage() error
- func GockRegisterLoginRequest() error
- func GockRegisterProfilePage() error
- func GockRegisterSemWiseCoursesPage() error
- func GockRegisterSemesterCoursesRequest(semesterRef string) error
- func GockRegisterUnauthenticatedGet(endpoint string) error
- func GockRegisterUnauthenticatedPost(endpoint string, requestBody string, responseBody io.Reader)
- func GockRegisterWifiInfo() error
- func GockRegisterWifiInfoOneSlot() error
- func GockRegisterWifiMacDeletion(params map[string]string, response File) error
- func GockRegisterWifiRegistration(payload url.Values) error
- type ExpectedJSON
- type File
- type Timestamp
Constants ¶
const ( ValidUser = "fakeUsername" ValidPass = "fakePassword" InvalidUser = "this-user-does-not-exist" InvalidPass = "this-password-does-not-either" AuthCookie = "fakeAuthCookie" VerificationToken = "fakeRequestVerificationToken" SessionID = "fakeSessionId" // StudentUUID is the UUID associated with the student used across testdata in filesystem. StudentUUID = "98RFGK88-A01C-1JJO-N73D-4BJR42B33J51" StudentName = "John Doe" StudentEnrollmentNumber = "A2305221007" StudentIDCardNumber = "95188911" StudentBloodGroup = "B-ve" StudentProgram = "B.Tech (CSE)" StudentBatch = "2020-2024" StudentIDValidity Timestamp = 1719705600 StudentDOB Timestamp = 986428800 // A valid mac address, and the first mac in the mock wifi pages ValidMac1 = "55-04-2d-e7-be-a4" ValidMac2 = "fd-d5-14-18-0c-8b" ValidMacNew = "dd-d5-14-18-0c-8c" )
Constants for use in tests using the mock package to create Gock requests, etc.
const BaseUrl = "https://s.amizone.net"
Variables ¶
This section is empty.
Functions ¶
func GockRegisterAuthenticatedGet ¶
GockRegisterAuthenticatedGet registers an authenticated GET request for the relative endpoint passed. The second parameter is used as the response body of the request.
func GockRegisterAuthenticatedGetWithParams ¶ added in v0.3.0
func GockRegisterAuthenticatedGetWithParams(endpoint string, params map[string]string, file File) error
GockRegisterAuthenticatedGetWithParams registers an authenticated GET request for the relative endpoint passed. The second parameter is used as the parameters of the request. The third parameter is used as the response body of the request.
func GockRegisterCalendarEndpoint ¶ added in v0.4.0
func GockRegisterCurrentCoursesPage ¶
func GockRegisterCurrentCoursesPage() error
func GockRegisterExamResultPage ¶ added in v0.8.0
func GockRegisterExamResultPage() error
func GockRegisterExamResultRequest ¶ added in v0.8.0
func GockRegisterHomePageLoggedIn ¶
func GockRegisterHomePageLoggedIn() error
GockRegisterHomePageLoggedIn registers a gock route for the amizone home page, serving the home page for a logged-in user from the mock filesystem. The request must have the referrers and cookies expected by the home page.
func GockRegisterLoginPage ¶
func GockRegisterLoginPage() error
GockRegisterLoginPage registers a gock route for the amizone login page serving the login page from the mock filesystem.
func GockRegisterLoginRequest ¶
func GockRegisterLoginRequest() error
GockRegisterLoginRequest registers 2 gock routes - one for valid credentials and one for invalid credentials. Valid credentials: ValidUser, ValidPass Invalid credentials: InvalidUser, InvalidPass
func GockRegisterProfilePage ¶ added in v0.2.0
func GockRegisterProfilePage() error
func GockRegisterSemWiseCoursesPage ¶
func GockRegisterSemWiseCoursesPage() error
func GockRegisterUnauthenticatedGet ¶
GockRegisterUnauthenticatedGet registers an unauthenticated GET request for the relative endpoint passed.
func GockRegisterWifiInfo ¶ added in v0.3.0
func GockRegisterWifiInfo() error
func GockRegisterWifiInfoOneSlot ¶ added in v0.3.0
func GockRegisterWifiInfoOneSlot() error
func GockRegisterWifiMacDeletion ¶ added in v0.3.0
func GockRegisterWifiRegistration ¶ added in v0.3.0
GockRegisterWifiRegistration() registers a gock route for the wifi registration page. The request must have the expected referrer, cookies and post data to be successful.
Types ¶
type ExpectedJSON ¶ added in v0.6.0
type ExpectedJSON string
const ( ExpectedFacultyFeedbackSpec ExpectedJSON = "testdata/expected__faculty_feedback_spec.json" ExpectedExamScheduleWithRoom ExpectedJSON = "testdata/expected__exam_schedule_with_room.json" )
type File ¶
type File string
const ( DiaryEventsNone File = "testdata/diary_events_none.json" DiaryEventsJSON File = "testdata/diary_events.json" DiaryEventsSmallJSON File = "testdata/diary_events_small.json" ExaminationSchedule File = "testdata/examination_schedule.html" ExaminationScheduleWithLocation File = "testdata/examination_schedule_exam_room.html" HomePageLoggedIn File = "testdata/home_page_logged_in.html" LoginPage File = "testdata/login_page.html" CoursesPage File = "testdata/my_courses.html" CoursesPageSemWise File = "testdata/courses_semwise.html" IDCardPage File = "testdata/id_card_page.html" WifiPage File = "testdata/wifi_mac_registration.html" WifiPageOneSlotPopulated File = "testdata/wifi_mac_registration_one_empty.html" FacultyPage File = "testdata/faculty_page.html" ExaminationResultPage File = "testdata/examination_result.html" )
Constants for file paths in the filesystem embedded filesystem.