Tests for AddProject to ensure creator is Manager
This commit is contained in:
parent
45761dadcb
commit
3525598df2
1 changed files with 28 additions and 0 deletions
|
@ -711,3 +711,31 @@ func TestChangeUserName(t *testing.T) {
|
||||||
t.Error("Expected GetUserId to fail for the old name, but it didn't")
|
t.Error("Expected GetUserId to fail for the old name, but it didn't")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEnsureManagerOfCreatedProject(t *testing.T) {
|
||||||
|
db, err := setupState()
|
||||||
|
if err != nil {
|
||||||
|
t.Error("setupState failed:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a user
|
||||||
|
err = db.AddUser("testuser", "password")
|
||||||
|
if err != nil {
|
||||||
|
t.Error("AddUser failed:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a project
|
||||||
|
err = db.AddProject("testproject", "description", "testuser")
|
||||||
|
if err != nil {
|
||||||
|
t.Error("AddProject failed:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
managerState, err := db.IsProjectManager("testuser", "testproject")
|
||||||
|
if err != nil {
|
||||||
|
t.Error("IsProjectManager failed:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !managerState {
|
||||||
|
t.Error("Expected testuser to be a project manager, but it's not.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue