Browse Source

use require.EqualError() in tests

pull/707/head
aler9 4 years ago
parent
commit
2d12c37074
  1. 4
      internal/conf/conf_test.go
  2. 2
      internal/core/core_test.go
  3. 6
      internal/core/rtsp_server_test.go

4
internal/conf/conf_test.go

@ -178,7 +178,7 @@ func TestConfErrorNonExistentParameter(t *testing.T) { @@ -178,7 +178,7 @@ func TestConfErrorNonExistentParameter(t *testing.T) {
defer os.Remove(tmpf)
_, _, err = Load(tmpf)
require.Equal(t, "non-existent parameter: 'invalid'", err.Error())
require.EqualError(t, err, "non-existent parameter: 'invalid'")
}()
func() {
@ -189,6 +189,6 @@ func TestConfErrorNonExistentParameter(t *testing.T) { @@ -189,6 +189,6 @@ func TestConfErrorNonExistentParameter(t *testing.T) {
defer os.Remove(tmpf)
_, _, err = Load(tmpf)
require.Equal(t, "parameter paths, key mypath: non-existent parameter: 'invalid'", err.Error())
require.EqualError(t, err, "parameter paths, key mypath: non-existent parameter: 'invalid'")
}()
}

2
internal/core/core_test.go

@ -193,7 +193,7 @@ func TestCoreHotReloading(t *testing.T) { @@ -193,7 +193,7 @@ func TestCoreHotReloading(t *testing.T) {
_, err := gortsplib.DialRead(
"rtsp://localhost:8554/test1",
)
require.Equal(t, "invalid status code: 400 (Bad Request)", err.Error())
require.EqualError(t, err, "invalid status code: 400 (Bad Request)")
}()
func() {

6
internal/core/rtsp_server_test.go

@ -334,7 +334,7 @@ func TestRTSPServerAuthFail(t *testing.T) { @@ -334,7 +334,7 @@ func TestRTSPServerAuthFail(t *testing.T) {
"rtsp://"+ca.user+":"+ca.pass+"@localhost:8554/test/stream",
gortsplib.Tracks{track},
)
require.Equal(t, "invalid status code: 401 (Unauthorized)", err.Error())
require.EqualError(t, err, "invalid status code: 401 (Unauthorized)")
})
}
@ -372,7 +372,7 @@ func TestRTSPServerAuthFail(t *testing.T) { @@ -372,7 +372,7 @@ func TestRTSPServerAuthFail(t *testing.T) {
_, err := gortsplib.DialRead(
"rtsp://" + ca.user + ":" + ca.pass + "@localhost:8554/test/stream",
)
require.Equal(t, "invalid status code: 401 (Unauthorized)", err.Error())
require.EqualError(t, err, "invalid status code: 401 (Unauthorized)")
})
}
@ -393,7 +393,7 @@ func TestRTSPServerAuthFail(t *testing.T) { @@ -393,7 +393,7 @@ func TestRTSPServerAuthFail(t *testing.T) {
"rtsp://localhost:8554/test/stream",
gortsplib.Tracks{track},
)
require.Equal(t, "invalid status code: 401 (Unauthorized)", err.Error())
require.EqualError(t, err, "invalid status code: 401 (Unauthorized)")
})
}

Loading…
Cancel
Save