Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for warning offline user #40

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

jgknight
Copy link
Contributor

@jgknight jgknight commented Jun 2, 2024

Summary

  • Two new unit tests for anonymous and identified EvilRequest when the recipient is offline
  • Move recipientSession into the test table
  • Some misc cleanup of existing tests/comments

Testing Done

All icbm foodgroup unit tests pass. Running all unit tests for the project also pass, and verified building ras was successful.

Running tool: /opt/homebrew/bin/go test -timeout 30s -run ^(TestICBMService_ChannelMsgToHost|TestICBMService_ClientEvent|TestICBMService_EvilRequest|TestICBMService_ParameterQuery)$ github.com/mk6i/retro-aim-server/foodgroup

=== RUN   TestICBMService_ChannelMsgToHost
=== RUN   TestICBMService_ChannelMsgToHost/transmit_message_from_sender_to_recipient,_ack_message_back_to_sender
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
--- PASS: TestICBMService_ChannelMsgToHost/transmit_message_from_sender_to_recipient,_ack_message_back_to_sender (0.00s)
=== RUN   TestICBMService_ChannelMsgToHost/transmit_message_from_sender_to_recipient,_don't_ack_message_back_to_sender
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
--- PASS: TestICBMService_ChannelMsgToHost/transmit_message_from_sender_to_recipient,_don't_ack_message_back_to_sender (0.00s)
=== RUN   TestICBMService_ChannelMsgToHost/don't_transmit_message_from_sender_to_recipient_because_sender_has_blocked_recipient
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
--- PASS: TestICBMService_ChannelMsgToHost/don't_transmit_message_from_sender_to_recipient_because_sender_has_blocked_recipient (0.00s)
=== RUN   TestICBMService_ChannelMsgToHost/don't_transmit_message_from_sender_to_recipient_because_recipient_has_blocked_sender
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
--- PASS: TestICBMService_ChannelMsgToHost/don't_transmit_message_from_sender_to_recipient_because_recipient_has_blocked_sender (0.00s)
=== RUN   TestICBMService_ChannelMsgToHost/don't_transmit_message_from_sender_to_recipient_because_recipient_doesn't_exist
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
--- PASS: TestICBMService_ChannelMsgToHost/don't_transmit_message_from_sender_to_recipient_because_recipient_doesn't_exist (0.00s)
--- PASS: TestICBMService_ChannelMsgToHost (0.00s)
=== RUN   TestICBMService_ClientEvent
=== RUN   TestICBMService_ClientEvent/transmit_message_from_sender_to_recipient
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
--- PASS: TestICBMService_ClientEvent/transmit_message_from_sender_to_recipient (0.00s)
=== RUN   TestICBMService_ClientEvent/don't_transmit_message_from_sender_to_recipient_because_sender_has_blocked_recipient
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
--- PASS: TestICBMService_ClientEvent/don't_transmit_message_from_sender_to_recipient_because_sender_has_blocked_recipient (0.00s)
--- PASS: TestICBMService_ClientEvent (0.00s)
=== RUN   TestICBMService_EvilRequest
=== RUN   TestICBMService_EvilRequest/transmit_anonymous_warning_from_sender_to_recipient
    /Users/josh/code/retro-aim-server/foodgroup/mock_legacy_buddy_list_manager_test.go:226: PASS:       WhoAddedUser(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenNames(string,[]string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: AdjacentUsers(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: Feedbag(string)
--- PASS: TestICBMService_EvilRequest/transmit_anonymous_warning_from_sender_to_recipient (0.00s)
=== RUN   TestICBMService_EvilRequest/transmit_non-anonymous_warning_from_sender_to_recipient
    /Users/josh/code/retro-aim-server/foodgroup/mock_legacy_buddy_list_manager_test.go:226: PASS:       WhoAddedUser(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenNames(string,[]string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: AdjacentUsers(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: Feedbag(string)
--- PASS: TestICBMService_EvilRequest/transmit_non-anonymous_warning_from_sender_to_recipient (0.00s)
=== RUN   TestICBMService_EvilRequest/don't_transmit_non-anonymous_warning_from_sender_to_recipient_because_sender_has_blocked_recipient
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenNames(string,[]string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: AdjacentUsers(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: Feedbag(string)
--- PASS: TestICBMService_EvilRequest/don't_transmit_non-anonymous_warning_from_sender_to_recipient_because_sender_has_blocked_recipient (0.00s)
=== RUN   TestICBMService_EvilRequest/don't_transmit_non-anonymous_warning_from_sender_to_recipient_because_recipient_has_blocked_sender
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenNames(string,[]string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: AdjacentUsers(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: Feedbag(string)
--- PASS: TestICBMService_EvilRequest/don't_transmit_non-anonymous_warning_from_sender_to_recipient_because_recipient_has_blocked_sender (0.00s)
=== RUN   TestICBMService_EvilRequest/don't_let_users_warn_themselves
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenNames(string,[]string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: AdjacentUsers(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: Feedbag(string)
--- PASS: TestICBMService_EvilRequest/don't_let_users_warn_themselves (0.00s)
=== RUN   TestICBMService_EvilRequest/don't_transmit_non-anonymous_warning_from_sender_to_recipient_because_recipient_is_offline
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenNames(string,[]string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: AdjacentUsers(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: Feedbag(string)
--- PASS: TestICBMService_EvilRequest/don't_transmit_non-anonymous_warning_from_sender_to_recipient_because_recipient_is_offline (0.00s)
=== RUN   TestICBMService_EvilRequest/don't_transmit_anonymous_warning_from_sender_to_recipient_because_recipient_is_offline
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RetrieveByScreenName(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenName(string,string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_message_relayer_test.go:154: PASS: RelayToScreenNames(string,[]string,wire.SNACMessage)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: BlockedState(string,string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: AdjacentUsers(string)
    /Users/josh/code/retro-aim-server/foodgroup/mock_feedbag_manager_test.go:417: PASS: Feedbag(string)
--- PASS: TestICBMService_EvilRequest/don't_transmit_anonymous_warning_from_sender_to_recipient_because_recipient_is_offline (0.00s)
--- PASS: TestICBMService_EvilRequest (0.00s)
=== RUN   TestICBMService_ParameterQuery
--- PASS: TestICBMService_ParameterQuery (0.00s)
PASS
ok      github.com/mk6i/retro-aim-server/foodgroup      (cached)

@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

foodgroup/icbm_test.go Outdated Show resolved Hide resolved
foodgroup/icbm_test.go Outdated Show resolved Hide resolved
foodgroup/icbm_test.go Outdated Show resolved Hide resolved
 - Two new unit tests for anonymous and identified EvilRequest when the recipient is offline
 - Move recipientSession into the test table
 - Some misc cleanup of existing tests/comments
@jgknight
Copy link
Contributor Author

jgknight commented Jun 2, 2024

Updated noted sessions to nil, reran and tests pass

Running tool: /opt/homebrew/bin/go test -timeout 30s -run ^TestICBMService_EvilRequest$ github.com/mk6i/retro-aim-server/foodgroup

ok  	github.com/mk6i/retro-aim-server/foodgroup	0.227s

@mk6i mk6i merged commit 7dc2057 into mk6i:main Jun 2, 2024
1 check passed
@jgknight jgknight deleted the add-evil-offline-unittest branch June 2, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants