-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use CurrentStatus in a few places
ircbot: use CurrentStatus stream to do song now starting announcements website: use CurrentStatus stream for now playing and streamer updates storage/mariadb: implement Status.Store with INSERT - UPDATE IF EXISTS
- Loading branch information
Showing
9 changed files
with
227 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package storagetest | ||
|
||
import ( | ||
"time" | ||
|
||
radio "github.com/R-a-dio/valkyrie" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func (suite *Suite) TestStatusStore() { | ||
t := suite.T() | ||
ss := suite.Storage.Status(suite.ctx) | ||
|
||
in := radio.Status{ | ||
User: radio.User{ | ||
DJ: radio.DJ{ | ||
ID: 500, | ||
}, | ||
}, | ||
Song: radio.Song{ | ||
Metadata: "testing data", | ||
DatabaseTrack: &radio.DatabaseTrack{ | ||
TrackID: 1500, | ||
}, | ||
}, | ||
SongInfo: radio.SongInfo{ | ||
Start: time.Date(2000, time.April, 1, 5, 6, 7, 8, time.UTC), | ||
End: time.Date(2010, time.February, 10, 15, 16, 17, 18, time.UTC), | ||
}, | ||
Listeners: 900, | ||
StreamerName: "test", | ||
Thread: "a cool thread", | ||
RequestsEnabled: true, | ||
} | ||
|
||
err := ss.Store(in) | ||
require.NoError(t, err) | ||
|
||
out, err := ss.Load() | ||
require.NoError(t, err) | ||
assert.Condition(t, func() (success bool) { | ||
return assert.Equal(t, in.User, out.User) && | ||
assert.Equal(t, in.Song, out.Song) && | ||
assert.WithinDuration(t, in.SongInfo.Start, out.SongInfo.Start, 0) && | ||
assert.WithinDuration(t, in.SongInfo.End, out.SongInfo.End, 0) && | ||
assert.Equal(t, in.Listeners, out.Listeners) && | ||
assert.Equal(t, in.StreamerName, out.StreamerName) && | ||
assert.Equal(t, in.Thread, out.Thread) && | ||
assert.Equal(t, in.RequestsEnabled, out.RequestsEnabled) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.