|
@@ -15,7 +15,7 @@ func TestSendAndReceiveChannelMsgTohost(t *testing.T) {
|
|
|
// name is the unit test name
|
|
// name is the unit test name
|
|
|
name string
|
|
name string
|
|
|
// blockedState is the response to the sender/recipient block check
|
|
// blockedState is the response to the sender/recipient block check
|
|
|
- blockedState BlockedState
|
|
|
|
|
|
|
+ blockedState user.BlockedState
|
|
|
// recipRetrieveErr is the error returned by the recipient session
|
|
// recipRetrieveErr is the error returned by the recipient session
|
|
|
// lookup
|
|
// lookup
|
|
|
recipRetrieveErr error
|
|
recipRetrieveErr error
|
|
@@ -32,7 +32,7 @@ func TestSendAndReceiveChannelMsgTohost(t *testing.T) {
|
|
|
}{
|
|
}{
|
|
|
{
|
|
{
|
|
|
name: "transmit message from sender to recipient, ack message back to sender",
|
|
name: "transmit message from sender to recipient, ack message back to sender",
|
|
|
- blockedState: BlockedNo,
|
|
|
|
|
|
|
+ blockedState: user.BlockedNo,
|
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
@@ -82,7 +82,7 @@ func TestSendAndReceiveChannelMsgTohost(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "transmit message from sender to recipient, don't ack message back to sender",
|
|
name: "transmit message from sender to recipient, don't ack message back to sender",
|
|
|
- blockedState: BlockedNo,
|
|
|
|
|
|
|
+ blockedState: user.BlockedNo,
|
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
@@ -115,7 +115,7 @@ func TestSendAndReceiveChannelMsgTohost(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "don't transmit message from sender to recipient because sender has blocked recipient",
|
|
name: "don't transmit message from sender to recipient because sender has blocked recipient",
|
|
|
- blockedState: BlockedA,
|
|
|
|
|
|
|
+ blockedState: user.BlockedA,
|
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
@@ -141,7 +141,7 @@ func TestSendAndReceiveChannelMsgTohost(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "don't transmit message from sender to recipient because recipient has blocked sender",
|
|
name: "don't transmit message from sender to recipient because recipient has blocked sender",
|
|
|
- blockedState: BlockedB,
|
|
|
|
|
|
|
+ blockedState: user.BlockedB,
|
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
recipientSession: newTestSession("recipient-screen-name", sessOptWarning(20)),
|
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
@@ -167,7 +167,7 @@ func TestSendAndReceiveChannelMsgTohost(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "don't transmit message from sender to recipient because recipient doesn't exist",
|
|
name: "don't transmit message from sender to recipient because recipient doesn't exist",
|
|
|
- blockedState: BlockedNo,
|
|
|
|
|
|
|
+ blockedState: user.BlockedNo,
|
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
senderSession: newTestSession("sender-screen-name", sessOptWarning(10)),
|
|
|
recipientSession: nil,
|
|
recipientSession: nil,
|
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
inputSNAC: oscar.SNAC_0x04_0x06_ICBMChannelMsgToHost{
|
|
@@ -235,7 +235,7 @@ func TestSendAndReceiveClientEvent(t *testing.T) {
|
|
|
// name is the unit test name
|
|
// name is the unit test name
|
|
|
name string
|
|
name string
|
|
|
// blockedState is the response to the sender/recipient block check
|
|
// blockedState is the response to the sender/recipient block check
|
|
|
- blockedState BlockedState
|
|
|
|
|
|
|
+ blockedState user.BlockedState
|
|
|
// senderScreenName is the screen name of the user sending the event
|
|
// senderScreenName is the screen name of the user sending the event
|
|
|
senderScreenName string
|
|
senderScreenName string
|
|
|
// inputSNAC is the SNAC sent by the sender client
|
|
// inputSNAC is the SNAC sent by the sender client
|
|
@@ -246,7 +246,7 @@ func TestSendAndReceiveClientEvent(t *testing.T) {
|
|
|
}{
|
|
}{
|
|
|
{
|
|
{
|
|
|
name: "transmit message from sender to recipient",
|
|
name: "transmit message from sender to recipient",
|
|
|
- blockedState: BlockedNo,
|
|
|
|
|
|
|
+ blockedState: user.BlockedNo,
|
|
|
senderScreenName: "sender-screen-name",
|
|
senderScreenName: "sender-screen-name",
|
|
|
inputSNAC: oscar.SNAC_0x04_0x14_ICBMClientEvent{
|
|
inputSNAC: oscar.SNAC_0x04_0x14_ICBMClientEvent{
|
|
|
Cookie: [8]byte{1, 2, 3, 4, 5, 6, 7, 8},
|
|
Cookie: [8]byte{1, 2, 3, 4, 5, 6, 7, 8},
|
|
@@ -269,7 +269,7 @@ func TestSendAndReceiveClientEvent(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "don't transmit message from sender to recipient because sender has blocked recipient",
|
|
name: "don't transmit message from sender to recipient because sender has blocked recipient",
|
|
|
- blockedState: BlockedA,
|
|
|
|
|
|
|
+ blockedState: user.BlockedA,
|
|
|
senderScreenName: "sender-screen-name",
|
|
senderScreenName: "sender-screen-name",
|
|
|
inputSNAC: oscar.SNAC_0x04_0x14_ICBMClientEvent{
|
|
inputSNAC: oscar.SNAC_0x04_0x14_ICBMClientEvent{
|
|
|
ScreenName: "recipient-screen-name",
|
|
ScreenName: "recipient-screen-name",
|
|
@@ -288,7 +288,7 @@ func TestSendAndReceiveClientEvent(t *testing.T) {
|
|
|
Return(tc.blockedState, nil).
|
|
Return(tc.blockedState, nil).
|
|
|
Maybe()
|
|
Maybe()
|
|
|
sm := NewMockSessionManager(t)
|
|
sm := NewMockSessionManager(t)
|
|
|
- if tc.blockedState == BlockedNo {
|
|
|
|
|
|
|
+ if tc.blockedState == user.BlockedNo {
|
|
|
sm.EXPECT().
|
|
sm.EXPECT().
|
|
|
SendToScreenName(mock.Anything, tc.inputSNAC.ScreenName, tc.expectSNACToClient)
|
|
SendToScreenName(mock.Anything, tc.inputSNAC.ScreenName, tc.expectSNACToClient)
|
|
|
}
|
|
}
|
|
@@ -310,7 +310,7 @@ func TestSendAndReceiveEvilRequest(t *testing.T) {
|
|
|
// name is the unit test name
|
|
// name is the unit test name
|
|
|
name string
|
|
name string
|
|
|
// blockedState is the response to the sender/recipient block check
|
|
// blockedState is the response to the sender/recipient block check
|
|
|
- blockedState BlockedState
|
|
|
|
|
|
|
+ blockedState user.BlockedState
|
|
|
// recipRetrieveErr is the error returned by the recipient session
|
|
// recipRetrieveErr is the error returned by the recipient session
|
|
|
// lookup
|
|
// lookup
|
|
|
recipRetrieveErr error
|
|
recipRetrieveErr error
|
|
@@ -332,7 +332,7 @@ func TestSendAndReceiveEvilRequest(t *testing.T) {
|
|
|
}{
|
|
}{
|
|
|
{
|
|
{
|
|
|
name: "transmit anonymous warning from sender to recipient",
|
|
name: "transmit anonymous warning from sender to recipient",
|
|
|
- blockedState: BlockedNo,
|
|
|
|
|
|
|
+ blockedState: user.BlockedNo,
|
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
|
recipientScreenName: "recipient-screen-name",
|
|
recipientScreenName: "recipient-screen-name",
|
|
|
broadcastMessage: oscar.XMessage{
|
|
broadcastMessage: oscar.XMessage{
|
|
@@ -377,7 +377,7 @@ func TestSendAndReceiveEvilRequest(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "transmit non-anonymous warning from sender to recipient",
|
|
name: "transmit non-anonymous warning from sender to recipient",
|
|
|
- blockedState: BlockedNo,
|
|
|
|
|
|
|
+ blockedState: user.BlockedNo,
|
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
|
recipientScreenName: "recipient-screen-name",
|
|
recipientScreenName: "recipient-screen-name",
|
|
|
recipientBuddies: []string{"buddy1", "buddy2"},
|
|
recipientBuddies: []string{"buddy1", "buddy2"},
|
|
@@ -426,7 +426,7 @@ func TestSendAndReceiveEvilRequest(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "don't transmit non-anonymous warning from sender to recipient because sender has blocked recipient",
|
|
name: "don't transmit non-anonymous warning from sender to recipient because sender has blocked recipient",
|
|
|
- blockedState: BlockedA,
|
|
|
|
|
|
|
+ blockedState: user.BlockedA,
|
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
|
recipientScreenName: "recipient-screen-name",
|
|
recipientScreenName: "recipient-screen-name",
|
|
|
recipientBuddies: []string{"buddy1", "buddy2"},
|
|
recipientBuddies: []string{"buddy1", "buddy2"},
|
|
@@ -446,7 +446,7 @@ func TestSendAndReceiveEvilRequest(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "don't transmit non-anonymous warning from sender to recipient because recipient has blocked sender",
|
|
name: "don't transmit non-anonymous warning from sender to recipient because recipient has blocked sender",
|
|
|
- blockedState: BlockedB,
|
|
|
|
|
|
|
+ blockedState: user.BlockedB,
|
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
senderSession: newTestSession("sender-screen-name"),
|
|
|
recipientScreenName: "recipient-screen-name",
|
|
recipientScreenName: "recipient-screen-name",
|
|
|
recipientBuddies: []string{"buddy1", "buddy2"},
|
|
recipientBuddies: []string{"buddy1", "buddy2"},
|