MCPcopy Create free account
hub / github.com/cncf/gitvote / create_vote_non_collaborator

Function create_vote_non_collaborator

src/processor.rs:847–874  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

845
846 #[tokio::test]
847 async fn create_vote_non_collaborator() {
848 let db = MockDB::new();
849 let mut gh = MockGH::new();
850 gh.expect_get_config_file()
851 .with(eq(INST_ID), eq(ORG), eq(REPO))
852 .times(1)
853 .returning(|_, _, _| Box::pin(future::ready(Some(get_test_valid_config()))));
854 gh.expect_user_is_collaborator()
855 .with(eq(INST_ID), eq(ORG), eq(REPO), eq(USER))
856 .times(1)
857 .returning(|_, _, _, _| Box::pin(future::ready(Ok(false))));
858 gh.expect_post_comment()
859 .withf(|inst_id, owner, repo, issue_number, body| {
860 let expected_body = tmpl::VoteRestricted::new(USER).render().unwrap();
861 *inst_id == INST_ID
862 && owner == ORG
863 && repo == REPO
864 && *issue_number == ISSUE_NUM
865 && body == expected_body.as_str()
866 })
867 .times(1)
868 .returning(|_, _, _, _, _| Box::pin(future::ready(Ok(COMMENT_ID))));
869
870 let (_, cmds_rx) = async_channel::unbounded();
871 let event = setup_test_issue_event();
872 let cmds_handler = CommandsHandler::new(Arc::new(db), Arc::new(gh), cmds_rx);
873 cmds_handler.create_vote(&CreateVoteInput::new(None, &Event::Issue(event))).await.unwrap();
874 }
875
876 #[tokio::test]
877 async fn create_vote_issue_already_has_a_vote() {

Callers

nothing calls this directly

Calls 4

get_test_valid_configFunction · 0.85
setup_test_issue_eventFunction · 0.85
IssueClass · 0.85
create_voteMethod · 0.80

Tested by

no test coverage detected