Fix shadowed variables in various places: Part 1 of 2 (#10175)

* Fix shadowed variables in cmd package

* Fix shadowed variables in plugin package

* Fix shadowed variables in store package

* Fix shadowed variables in web package

* Changes as requested

Signed-off-by: Hanzei <hanzei@mailbox.org>

* Fix build

* Remove unnessary statements

* Use require all the time

* Fix build

* Rename variables according to feedback

* Fix NPE

* Changes as requested
This commit is contained in:
Hanzei
2019-01-30 18:55:24 +01:00
committed by Jesse Hallam
parent 2c9cf41dad
commit d898787371
6 changed files with 62 additions and 70 deletions

View File

@@ -563,36 +563,25 @@ func testChannelStoreGetByName(t *testing.T, ss store.Store) {
o1.Type = model.CHANNEL_OPEN
store.Must(ss.Channel().Save(&o1, -1))
r1 := <-ss.Channel().GetByName(o1.TeamId, o1.Name, true)
if r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Channel).ToJson() != o1.ToJson() {
t.Fatal("invalid returned channel")
}
}
result := <-ss.Channel().GetByName(o1.TeamId, o1.Name, true)
require.Nil(t, result.Err)
require.Equal(t, o1.ToJson(), result.Data.(*model.Channel).ToJson(), "invalid returned channel")
if err := (<-ss.Channel().GetByName(o1.TeamId, "", true)).Err; err == nil {
t.Fatal("Missing id should have failed")
}
channelID := result.Data.(*model.Channel).Id
if r1 := <-ss.Channel().GetByName(o1.TeamId, o1.Name, false); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Channel).ToJson() != o1.ToJson() {
t.Fatal("invalid returned channel")
}
}
result = <-ss.Channel().GetByName(o1.TeamId, "", true)
require.NotNil(t, result.Err, "Missing id should have failed")
if err := (<-ss.Channel().GetByName(o1.TeamId, "", false)).Err; err == nil {
t.Fatal("Missing id should have failed")
}
result = <-ss.Channel().GetByName(o1.TeamId, o1.Name, false)
require.Nil(t, result.Err)
require.Equal(t, o1.ToJson(), result.Data.(*model.Channel).ToJson(), "invalid returned channel")
store.Must(ss.Channel().Delete(r1.Data.(*model.Channel).Id, model.GetMillis()))
result = <-ss.Channel().GetByName(o1.TeamId, "", false)
require.NotNil(t, result.Err, "Missing id should have failed")
if err := (<-ss.Channel().GetByName(o1.TeamId, r1.Data.(*model.Channel).Name, false)).Err; err == nil {
t.Fatal("Deleted channel should not be returned by GetByName()")
}
store.Must(ss.Channel().Delete(channelID, model.GetMillis()))
result = <-ss.Channel().GetByName(o1.TeamId, o1.Name, false)
require.NotNil(t, result.Err, "Deleted channel should not be returned by GetByName()")
}
func testChannelStoreGetByNames(t *testing.T, ss store.Store) {