func (s *SkillSuite) TestCreateSkill(c *C) { skill := s.store.Skills.Create(model.A{"QueueUid": "queue123", "TeammateUid": "teammate456"}, s.owner) c.Assert(skill.QueueUid(), Equals, "queue123") c.Assert(skill.TeammateUid(), Equals, "teammate456") c.Assert(skill.TeamUid(), Equals, s.owner.Uid()) queue := SkillOwner{event.NewIdentity("Queue")} teammate := SkillOwner{event.NewIdentity("Teammate")} alternative := s.store.Skills.Create(model.A{}, s.owner, queue, teammate) c.Assert(alternative.QueueUid(), Equals, queue.Uid()) c.Assert(alternative.TeammateUid(), Equals, teammate.Uid()) c.Assert(alternative.TeamUid(), Equals, s.owner.Uid()) }
func (s *TeammateSuite) SetUpTest(c *C) { s.busManager = event.NewBusManager() s.busManager.Start() s.store = model.NewStore(s.busManager) s.owner = &TeammateOwner{event.NewIdentity("Team")} s.teammate = s.store.Teammates.Create(model.A{"Name": "Agent"}, s.owner) }
func NewTeammate(attributes A) (teammate *Teammate) { teammate = newModel(&Teammate{}, &attributes).(*Teammate) if teammate.InternalStatus == StatusNone { teammate.InternalStatus = StatusSignedOut } teammate.Identity = event.NewIdentity("Teammate") return teammate }
func NewTask(attributes A) (task *Task) { task = newModel(&Task{}, &attributes).(*Task) if task.InternalStatus == StatusNone { task.InternalStatus = StatusCreated } task.Identity = event.NewIdentity("Task") return task }
func NewSkill(attributes A) (skill *Skill) { skill = newModel(&Skill{}, &attributes).(*Skill) if skill.AttrLevel == LevelNone { skill.AttrLevel = LevelMedium } skill.Identity = event.NewIdentity("Skill") return skill }
func (s *IdentitySuite) TestCopyIdentity(c *C) { original := event.NewIdentity("Team") copy := original.Copy() c.Assert(copy.Kind(), Equals, original.Kind()) c.Assert(copy.Uid(), Equals, original.Uid()) c.Assert(original.IsCopy(), Equals, false) c.Assert(copy.IsCopy(), Equals, true) copy.SetKind("Teammate") copy.SetUid("blah-blah") c.Assert(copy.Kind(), Not(Equals), original.Kind()) c.Assert(copy.Uid(), Not(Equals), original.Uid()) }
func (s *QueueSuite) SetUpTest(c *C) { s.store = model.NewStore(nil) s.owner = &QueueOwner{event.NewIdentity("Team")} }
func (s *SkillSuite) SetUpTest(c *C) { s.store = model.NewStore(nil) s.owner = &SkillOwner{event.NewIdentity("Team")} }
func NewQueue(attributes A) (queue *Queue) { queue = newModel(&Queue{}, &attributes).(*Queue) queue.Identity = event.NewIdentity("Queue") queue.Tasks = llrb.New(TaskLess) return queue }
func (s *BusManagerSuite) SetUpTest(c *C) { s.busManager = event.NewBusManager() s.busManager.Start() s.identity = event.NewIdentity("Team") }
func (s *IdentitySuite) TestNoIdentity(c *C) { identity := event.NewIdentity() c.Assert(event.NoIdentity(identity), Equals, true) identity.SetUid("123abc") c.Assert(event.NoIdentity(identity), Equals, false) }
func (s *IdentitySuite) TestGenerateUid(c *C) { identity := event.NewIdentity("Team") c.Assert(identity.Uid(), HasLen, 17) c.Assert(identity.Uid()[8:9], Equals, "-") }
func (s *IdentitySuite) TestNewIdentity(c *C) { identity := event.NewIdentity("Team", "blah") c.Assert(identity.Kind(), Equals, "Team") c.Assert(identity.Uid(), Equals, "blah") }
func NewTeam(attributes A) (team *Team) { team = newModel(&Team{}, &attributes).(*Team) team.Identity = event.NewIdentity("Team") return team }