示例#1
0
func (s *ConversationSuite) Test_sendAll_returnsTheFirstErrorEncountered(c *C) {
	cb := &conversation{"*****@*****.**", "", &otr3.Conversation{}}
	ts := &testSender{err: errors.New("hello")}
	e := cb.sendAll(ts, "", []otr3.ValidMessage{otr3.ValidMessage([]byte("Hello there"))})

	c.Assert(e, DeepEquals, errors.New("hello"))
}
示例#2
0
func (s *ConversationSuite) Test_sendAll_sendsTheMessageGiven(c *C) {
	cb := &conversation{"*****@*****.**", "", &otr3.Conversation{}}
	ts := &testSender{err: nil}
	e := cb.sendAll(ts, "", []otr3.ValidMessage{otr3.ValidMessage([]byte("Hello there"))})

	c.Assert(e, IsNil)
	c.Assert(ts.peer, Equals, "*****@*****.**")
	c.Assert(ts.msg, Equals, "Hello there")
}