mirror of https://github.com/dirtbags/moth.git
Adding more state filesystem checks
This commit is contained in:
parent
bfacbfeb11
commit
6187ab4968
|
@ -3,3 +3,4 @@
|
||||||
.idea
|
.idea
|
||||||
/vendor/
|
/vendor/
|
||||||
__debug_bin
|
__debug_bin
|
||||||
|
coverage.txt
|
||||||
|
|
|
@ -563,8 +563,6 @@ func TestStateTeamIDs(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add a team ID
|
// Add a team ID
|
||||||
if err := s.AddTeamID(teamID1); err != nil {
|
if err := s.AddTeamID(teamID1); err != nil {
|
||||||
t.Errorf("Received unexpected error %s", err)
|
t.Errorf("Received unexpected error %s", err)
|
||||||
|
@ -666,6 +664,8 @@ func TestStateDeleteTeamIDList(t *testing.T) {
|
||||||
s := NewTestState()
|
s := NewTestState()
|
||||||
s.refresh()
|
s.refresh()
|
||||||
|
|
||||||
|
teamID1 := "foobar"
|
||||||
|
|
||||||
s.Fs.Remove("teamids.txt")
|
s.Fs.Remove("teamids.txt")
|
||||||
|
|
||||||
teamIDs, err := s.TeamIDs()
|
teamIDs, err := s.TeamIDs()
|
||||||
|
@ -675,8 +675,40 @@ func TestStateDeleteTeamIDList(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Errorf("Did not receive expected error for non-existent teamids.txt")
|
t.Error("Did not receive expected error for non-existent teamids.txt")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := s.AddTeamID(teamID1); err == nil {
|
||||||
|
t.Error("Expected to receive error when adding team with no teamids.txt, received nil, instead")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := s.RemoveTeamID(teamID1); err == nil {
|
||||||
|
t.Error("Expected to receive error when removing team with no teamids.txt, received nil, instead")
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := s.TeamIDExists(teamID1); err == nil {
|
||||||
|
t.Error("Expected to receive error when checking team ID with no teamids.txt, received nil, instead")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStatePermissionError(t *testing.T) {
|
||||||
|
t.Skip("Skipping because of how hard it is to tease out this error state")
|
||||||
|
|
||||||
|
s := NewTestState()
|
||||||
|
s.refresh()
|
||||||
|
|
||||||
|
emptyTeams := make([]string, 0)
|
||||||
|
|
||||||
|
if err := s.writeTeamIDs(emptyTeams); err != nil {
|
||||||
|
t.Errorf("Unexpected error when initializing teamids.txt, %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
s.Fs.Chmod("teamids.txt", 0100)
|
||||||
|
|
||||||
|
if err := s.writeTeamIDs(emptyTeams); err == nil {
|
||||||
|
t.Error("Expected to receive error when making a bad write to teamids.txt, received nil, instead")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStateTeamNames(t *testing.T) {
|
func TestStateTeamNames(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue