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

Function check_vote_checked_recently

src/processor.rs:1316–1341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1314
1315 #[tokio::test]
1316 async fn check_vote_checked_recently() {
1317 let mut db = MockDB::new();
1318 db.expect_get_open_vote().with(eq(REPOFN), eq(ISSUE_NUM)).times(1).returning(|_, _| {
1319 Box::pin(future::ready(Ok(Some(Vote {
1320 checked_at: OffsetDateTime::now_utc().checked_sub(1.hours()),
1321 ..setup_test_vote()
1322 }))))
1323 });
1324 let mut gh = MockGH::new();
1325 gh.expect_post_comment()
1326 .withf(|inst_id, owner, repo, issue_number, body| {
1327 let expected_body = tmpl::VoteCheckedRecently {}.render().unwrap();
1328 *inst_id == INST_ID
1329 && owner == ORG
1330 && repo == REPO
1331 && *issue_number == ISSUE_NUM
1332 && body == expected_body.as_str()
1333 })
1334 .times(1)
1335 .returning(|_, _, _, _, _| Box::pin(future::ready(Ok(COMMENT_ID))));
1336
1337 let (_, cmds_rx) = async_channel::unbounded();
1338 let event = setup_test_pr_event();
1339 let cmds_handler = CommandsHandler::new(Arc::new(db), Arc::new(gh), cmds_rx);
1340 cmds_handler.check_vote(&CheckVoteInput::new(&Event::PullRequest(event))).await.unwrap();
1341 }
1342
1343 #[tokio::test]
1344 async fn check_vote_success() {

Callers

nothing calls this directly

Calls 4

setup_test_voteFunction · 0.85
setup_test_pr_eventFunction · 0.85
PullRequestClass · 0.85
check_voteMethod · 0.80

Tested by

no test coverage detected