Documentation ¶
Index ¶
- func ConvertByteResp(resp *http.Response) []byte
- func ConvertResp(resp *http.Response) string
- func SetCookie(jar *cookiejar.Jar, key string, value string, exp *net.CookieExp, url *url.URL)
- type DummyUser
- func (c *DummyUser) AddLoginToken(ctx context.Context, db *database.Database, now time.Time) (string, string, error)
- func (c *DummyUser) AddRole(role string) *DummyUser
- func (c *DummyUser) AddUserCert(ctx context.Context, db *database.Database) (*models.Certification, error)
- func (c *DummyUser) AddUserInfo(ctx context.Context, db *database.Database) (*models.User, error)
- func (c *DummyUser) GenOTPCode() (string, error)
- func (c *DummyUser) NewOTP() (*DummyUser, error)
- type TestServer
- func (c *TestServer) AddSession(ctx context.Context, db *database.Database, dummy *DummyUser) error
- func (c *TestServer) Close()
- func (c *TestServer) Delete(t *testing.T, path string) *http.Response
- func (c *TestServer) FindCookies(t *testing.T, cookies []string)
- func (c *TestServer) Get(t *testing.T, path string) *http.Response
- func (c *TestServer) GetCookie(key string) string
- func (c *TestServer) Head(t *testing.T, path string) *http.Response
- func (c *TestServer) Post(t *testing.T, path string, form interface{}) *http.Response
- func (c *TestServer) PostForm(t *testing.T, path string, form url.Values) *http.Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DummyUser ¶
type DummyUser struct { UserID string Mail string Otp *secure.OnetimePassword Roles []string AccessID string }
func NewDummyUser ¶
func NewDummyUser() *DummyUser
func (*DummyUser) AddLoginToken ¶
func (c *DummyUser) AddLoginToken(ctx context.Context, db *database.Database, now time.Time) (string, string, error)
session-tokenとrefresh-tokenをセットする テスト用
func (*DummyUser) AddUserCert ¶
func (c *DummyUser) AddUserCert(ctx context.Context, db *database.Database) (*models.Certification, error)
ユーザの認証情報を追加する (テスト用)
func (*DummyUser) AddUserInfo ¶
ユーザを追加する (テスト用)
type TestServer ¶
type TestServer struct { Server *httptest.Server Client *http.Client Jar *cookiejar.Jar Dummy *DummyUser Url *url.URL SessionToken string RefreshToken string }
func NewTestServer ¶
func (*TestServer) AddSession ¶
cookieにセッション情報を追加する
func (*TestServer) Close ¶
func (c *TestServer) Close()
func (*TestServer) FindCookies ¶
func (c *TestServer) FindCookies(t *testing.T, cookies []string)
cookieが存在するかをチェックする
func (*TestServer) GetCookie ¶
func (c *TestServer) GetCookie(key string) string
Click to show internal directories.
Click to hide internal directories.