Пример #1
0
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())
}
Пример #2
0
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)
}
Пример #3
0
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
}
Пример #4
0
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
}
Пример #5
0
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
}
Пример #6
0
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())
}
Пример #7
0
func (s *QueueSuite) SetUpTest(c *C) {
	s.store = model.NewStore(nil)
	s.owner = &QueueOwner{event.NewIdentity("Team")}
}
Пример #8
0
func (s *SkillSuite) SetUpTest(c *C) {
	s.store = model.NewStore(nil)
	s.owner = &SkillOwner{event.NewIdentity("Team")}
}
Пример #9
0
func NewQueue(attributes A) (queue *Queue) {
	queue = newModel(&Queue{}, &attributes).(*Queue)
	queue.Identity = event.NewIdentity("Queue")
	queue.Tasks = llrb.New(TaskLess)
	return queue
}
Пример #10
0
func (s *BusManagerSuite) SetUpTest(c *C) {
	s.busManager = event.NewBusManager()
	s.busManager.Start()
	s.identity = event.NewIdentity("Team")
}
Пример #11
0
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)
}
Пример #12
0
func (s *IdentitySuite) TestGenerateUid(c *C) {
	identity := event.NewIdentity("Team")
	c.Assert(identity.Uid(), HasLen, 17)
	c.Assert(identity.Uid()[8:9], Equals, "-")
}
Пример #13
0
func (s *IdentitySuite) TestNewIdentity(c *C) {
	identity := event.NewIdentity("Team", "blah")
	c.Assert(identity.Kind(), Equals, "Team")
	c.Assert(identity.Uid(), Equals, "blah")
}
Пример #14
0
func NewTeam(attributes A) (team *Team) {
	team = newModel(&Team{}, &attributes).(*Team)
	team.Identity = event.NewIdentity("Team")
	return team
}