Tiny bit more test.
This commit is contained in:
parent
54e14babb2
commit
ad1d0fac60
2 changed files with 57 additions and 6 deletions
|
@ -203,6 +203,23 @@ func TestOpenClose(t *testing.T) {
|
||||||
t.Fatalf("TestClose, d.Open failed: %+v", err)
|
t.Fatalf("TestClose, d.Open failed: %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !waitBoolEqual(10*time.Second, &d.DataReady, true) {
|
||||||
|
t.Fatal("DataReady never became true.")
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO find a better way
|
||||||
|
// Add a small sleep here to make sure heartbeat and other events
|
||||||
|
// have enough time to get fired. Need a way to actually check
|
||||||
|
// those events.
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
|
|
||||||
|
// UpdateStatus - maybe we move this into wsapi_test.go but the websocket
|
||||||
|
// created here is needed. This helps tests that the websocket was setup
|
||||||
|
// and it is working.
|
||||||
|
if err = d.UpdateStatus(0, time.Now().String()); err != nil {
|
||||||
|
t.Errorf("UpdateStatus error: %+v", err)
|
||||||
|
}
|
||||||
|
|
||||||
if err = d.Close(); err != nil {
|
if err = d.Close(); err != nil {
|
||||||
t.Fatalf("TestClose, d.Close failed: %+v", err)
|
t.Fatalf("TestClose, d.Close failed: %+v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,20 @@ import (
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////// START OF TESTS
|
/////////////////////////////////////////////////////////////// START OF TESTS
|
||||||
|
|
||||||
// TestLogout tests the Logout() function. This should not return an error.
|
// TestChannelMessageSend tests the ChannelMessageSend() function. This should not return an error.
|
||||||
func TestLogout(t *testing.T) {
|
func TestChannelMessageSend(t *testing.T) {
|
||||||
|
|
||||||
if dg == nil {
|
if envChannel == "" {
|
||||||
t.Skip("Cannot TestLogout, dg not set.")
|
t.Skip("Skipping, DG_CHANNEL not set.")
|
||||||
}
|
}
|
||||||
|
|
||||||
err := dg.Logout()
|
if dg == nil {
|
||||||
|
t.Skip("Skipping, dg not set.")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := dg.ChannelMessageSend(envChannel, "Running REST API Tests!")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Logout() returned error: %+v", err)
|
t.Errorf("ChannelMessageSend returned error: %+v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,3 +119,33 @@ func TestUserSettings(t *testing.T) {
|
||||||
t.Errorf(err.Error())
|
t.Errorf(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestLogout tests the Logout() function. This should not return an error.
|
||||||
|
func TestLogout(t *testing.T) {
|
||||||
|
|
||||||
|
if dg == nil {
|
||||||
|
t.Skip("Cannot TestLogout, dg not set.")
|
||||||
|
}
|
||||||
|
|
||||||
|
err := dg.Logout()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Logout() returned error: %+v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestChannelMessageSend2 tests the ChannelMessageSend() function. This should not return an error.
|
||||||
|
func TestChannelMessageSend2(t *testing.T) {
|
||||||
|
|
||||||
|
if envChannel == "" {
|
||||||
|
t.Skip("Skipping, DG_CHANNEL not set.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if dg == nil {
|
||||||
|
t.Skip("Skipping, dg not set.")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := dg.ChannelMessageSend(envChannel, "All done running REST API Tests!")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("ChannelMessageSend returned error: %+v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue