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

Function automatic_command_from_pr_event

src/cmd.rs:385–409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

383
384 #[tokio::test]
385 async fn automatic_command_from_pr_event() {
386 let mut gh = MockGH::new();
387 gh.expect_get_config_file()
388 .with(eq(INST_ID), eq(ORG), eq(REPO))
389 .times(1)
390 .returning(|_, _, _| Box::pin(future::ready(Some(get_test_valid_config()))));
391 gh.expect_get_pr_files()
392 .with(eq(INST_ID), eq(ORG), eq(REPO), eq(ISSUE_NUM))
393 .times(1)
394 .returning(|_, _, _, _| {
395 Box::pin(future::ready(Ok(vec![File {
396 filename: "README.md".to_string(),
397 }])))
398 });
399 let gh = Arc::new(gh);
400
401 let mut event = setup_test_pr_event();
402 event.action = PullRequestEventAction::Opened;
403 let event = Event::PullRequest(event);
404
405 assert_eq!(
406 Command::from_event_automatic(gh, &event.clone()).await.unwrap(),
407 Some(Command::CreateVote(CreateVoteInput::new(Some("default"), &event)))
408 );
409 }
410}

Callers

nothing calls this directly

Calls 3

get_test_valid_configFunction · 0.85
setup_test_pr_eventFunction · 0.85
PullRequestClass · 0.85

Tested by

no test coverage detected