forked from openprivacy/libricochet-go
Testing MultiChannel Response Condition in Channel Manage
This commit is contained in:
parent
6e2bfbbc14
commit
30808c71b2
|
@ -5,6 +5,34 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type OverrideChatChannel struct {
|
||||||
|
channels.ChatChannel
|
||||||
|
}
|
||||||
|
|
||||||
|
// Singleton - for chat channels there can only be one instance per direction
|
||||||
|
func (cc *OverrideChatChannel) Singleton() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func TestClientManagerDuplicateMultiple(t *testing.T) {
|
||||||
|
ccm := NewClientChannelManager()
|
||||||
|
chatChannel := new(OverrideChatChannel)
|
||||||
|
_, err := ccm.OpenChannelRequestFromPeer(2, chatChannel)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Opening ChatChannel should have succeeded, instead: %v", err)
|
||||||
|
}
|
||||||
|
_, err = ccm.OpenChannelRequestFromPeer(4, chatChannel)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Opening ChatChannel should have succeeded, instead: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
channel := ccm.Channel("im.ricochet.chat", channels.Inbound)
|
||||||
|
if channel != nil {
|
||||||
|
t.Errorf("Get ChatChannel should have failed because there are 2 of them")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestClientManagerDuplicateChannel(t *testing.T) {
|
func TestClientManagerDuplicateChannel(t *testing.T) {
|
||||||
ccm := NewClientChannelManager()
|
ccm := NewClientChannelManager()
|
||||||
chatChannel := new(channels.ChatChannel)
|
chatChannel := new(channels.ChatChannel)
|
||||||
|
|
Loading…
Reference in New Issue