本文整理汇总了Golang中github.com/concourse/atc/db.DB.GetTeamByName方法的典型用法代码示例。如果您正苦于以下问题:Golang DB.GetTeamByName方法的具体用法?Golang DB.GetTeamByName怎么用?Golang DB.GetTeamByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/concourse/atc/db.DB
的用法示例。
在下文中一共展示了DB.GetTeamByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Describe("the default team", func() {
Describe("it exists", func() {
BeforeEach(func() {
defaultTeam := db.Team{
Name: atc.DefaultTeamName,
}
_, err := database.SaveTeam(defaultTeam)
Expect(err).NotTo(HaveOccurred())
})
It("it does not get duplicated", func() {
err := database.CreateDefaultTeamIfNotExists()
Expect(err).NotTo(HaveOccurred())
team, found, err := database.GetTeamByName(atc.DefaultTeamName)
Expect(err).NotTo(HaveOccurred())
Expect(found).To(BeTrue())
Expect(team.Name).To(Equal(atc.DefaultTeamName))
Expect(team.Admin).To(BeTrue())
})
Context("and it does not have admin permissions", func() {
It("it sets admin permissions on that team", func() {
err := database.CreateDefaultTeamIfNotExists()
Expect(err).NotTo(HaveOccurred())
team, _, err := database.GetTeamByName(atc.DefaultTeamName)
Expect(err).NotTo(HaveOccurred())
Expect(team.Admin).To(BeTrue())
})