Fix tests

This commit is contained in:
Tulir Asokan 2018-05-22 16:54:35 +03:00
parent 3c23126e7f
commit 09703c6b9c

View File

@ -117,7 +117,6 @@ func TestContainer_SendTyping(t *testing.T) {
func TestContainer_JoinRoom(t *testing.T) { func TestContainer_JoinRoom(t *testing.T) {
defer os.RemoveAll("/tmp/gomuks-mxtest-2") defer os.RemoveAll("/tmp/gomuks-mxtest-2")
cfg := config.NewConfig("/tmp/gomuks-mxtest-2", "/tmp/gomuks-mxtest-2") cfg := config.NewConfig("/tmp/gomuks-mxtest-2", "/tmp/gomuks-mxtest-2")
cfg.LoadSession("@user:example.com")
c := Container{client: mockClient(func(req *http.Request) (*http.Response, error) { c := Container{client: mockClient(func(req *http.Request) (*http.Response, error) {
if req.Method == http.MethodPost && req.URL.Path == "/_matrix/client/r0/join/!foo:example.com" { if req.Method == http.MethodPost && req.URL.Path == "/_matrix/client/r0/join/!foo:example.com" {
return mockResponse(http.StatusOK, `{"room_id": "!foo:example.com"}`), nil return mockResponse(http.StatusOK, `{"room_id": "!foo:example.com"}`), nil
@ -140,8 +139,7 @@ func TestContainer_JoinRoom(t *testing.T) {
func TestContainer_Download(t *testing.T) { func TestContainer_Download(t *testing.T) {
defer os.RemoveAll("/tmp/gomuks-mxtest-3") defer os.RemoveAll("/tmp/gomuks-mxtest-3")
cfg := config.NewConfig("/tmp/gomuks-mxtest-3", "/tmp/gomuks-mxtest-3") cfg := config.NewConfig("/tmp/gomuks-mxtest-3", "/tmp/gomuks-mxtest-3")
cfg.Load() cfg.LoadAll()
cfg.LoadSession("@user:example.com")
callCounter := 0 callCounter := 0
c := Container{client: mockClient(func(req *http.Request) (*http.Response, error) { c := Container{client: mockClient(func(req *http.Request) (*http.Response, error) {
if req.Method != http.MethodGet || req.URL.Path != "/_matrix/media/v1/download/example.com/foobar" { if req.Method != http.MethodGet || req.URL.Path != "/_matrix/media/v1/download/example.com/foobar" {