forked from Team254/cheesy-arena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_settings_test.go
35 lines (30 loc) · 1.02 KB
/
event_settings_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2014 Team 254. All Rights Reserved.
// Author: [email protected] (Patrick Fairbank)
package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestEventSettingsReadWrite(t *testing.T) {
clearDb()
defer clearDb()
db, err := OpenDatabase(testDbPath)
assert.Nil(t, err)
defer db.Close()
eventSettings, err := db.GetEventSettings()
assert.Nil(t, err)
assert.Equal(t, EventSettings{Id: 0, Name: "Untitled Event", Code: "UE", DisplayBackgroundColor: "#00ff00",
NumElimAlliances: 8, SelectionRound2Order: "L", SelectionRound3Order: "",
TeamInfoDownloadEnabled: true}, *eventSettings)
eventSettings.Name = "Chezy Champs"
eventSettings.Code = "cc"
eventSettings.DisplayBackgroundColor = "#ff00ff"
eventSettings.NumElimAlliances = 6
eventSettings.SelectionRound2Order = "F"
eventSettings.SelectionRound3Order = "L"
err = db.SaveEventSettings(eventSettings)
assert.Nil(t, err)
eventSettings2, err := db.GetEventSettings()
assert.Nil(t, err)
assert.Equal(t, *eventSettings, *eventSettings2)
}