Compare commits
No commits in common. "975c9e315ce2a59ebb6742a0b1e42c1716dcec8c" and "0796df00d49120004186ace7681815d0c4771fdb" have entirely different histories.
975c9e315c
...
0796df00d4
4 changed files with 1 additions and 57 deletions
|
@ -57,7 +57,7 @@ on_success = "back" # so that
|
||||||
# If you want to pass options to your program, a `--` separator
|
# If you want to pass options to your program, a `--` separator
|
||||||
# will be needed.
|
# will be needed.
|
||||||
[jobs.run]
|
[jobs.run]
|
||||||
command = ["cargo", "run", "--color", "always", "--", "server", "start"]
|
command = ["cargo", "run", "--color", "always"]
|
||||||
need_stdout = true
|
need_stdout = true
|
||||||
allow_warnings = true
|
allow_warnings = true
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ stateDiagram-v2
|
||||||
|
|
||||||
CloneRepo --> LoadConfigFromRepo :on repo config
|
CloneRepo --> LoadConfigFromRepo :on repo config
|
||||||
CloneRepo --> ValidateRepo :on server config
|
CloneRepo --> ValidateRepo :on server config
|
||||||
CloneRepo --> RegisterWebhook :on server config
|
|
||||||
|
|
||||||
LoadConfigFromRepo --> ReceiveRepoConfig
|
LoadConfigFromRepo --> ReceiveRepoConfig
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,6 @@ impl Handler<actor::messages::CloneRepo> for actor::RepoActor {
|
||||||
&self.log,
|
&self.log,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
actor::do_send(
|
|
||||||
ctx.address(),
|
|
||||||
actor::messages::RegisterWebhook::new(),
|
|
||||||
&self.log,
|
|
||||||
);
|
|
||||||
actor::do_send(
|
actor::do_send(
|
||||||
ctx.address(),
|
ctx.address(),
|
||||||
actor::messages::ValidateRepo::new(self.message_token),
|
actor::messages::ValidateRepo::new(self.message_token),
|
||||||
|
|
|
@ -105,56 +105,6 @@ async fn when_server_has_no_repo_config_should_send_load_from_repo() -> TestResu
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The server config can optionally include the names of the main, next and dev
|
|
||||||
/// branches. When it does we should go straight to sending a [ValidateRepo] message.
|
|
||||||
#[actix::test]
|
|
||||||
async fn when_server_has_repo_config_should_send_validate_repo() -> TestResult {
|
|
||||||
//given
|
|
||||||
let fs = given::a_filesystem();
|
|
||||||
let (mut open_repository, repo_details) = given::an_open_repository(&fs);
|
|
||||||
#[allow(clippy::unwrap_used)]
|
|
||||||
given::has_all_valid_remote_defaults(&mut open_repository, &repo_details);
|
|
||||||
|
|
||||||
let mut repository_factory = MockRepositoryFactory::new();
|
|
||||||
expect::open_repository(&mut repository_factory, open_repository);
|
|
||||||
fs.dir_create(&repo_details.gitdir)?;
|
|
||||||
|
|
||||||
//when
|
|
||||||
let (addr, log) = when::start_actor(repository_factory, repo_details, given::a_forge());
|
|
||||||
addr.send(CloneRepo::new()).await?;
|
|
||||||
System::current().stop();
|
|
||||||
|
|
||||||
//then
|
|
||||||
log.require_message_containing("send: ValidateRepo")?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The server config can optionally include the names of the main, next and dev
|
|
||||||
/// branches. When it does we should register the webhook by sending [RegisterWebhook] message.
|
|
||||||
#[actix::test]
|
|
||||||
async fn when_server_has_repo_config_should_send_register_webhook() -> TestResult {
|
|
||||||
//given
|
|
||||||
let fs = given::a_filesystem();
|
|
||||||
let (mut open_repository, repo_details) = given::an_open_repository(&fs);
|
|
||||||
#[allow(clippy::unwrap_used)]
|
|
||||||
given::has_all_valid_remote_defaults(&mut open_repository, &repo_details);
|
|
||||||
|
|
||||||
let mut repository_factory = MockRepositoryFactory::new();
|
|
||||||
expect::open_repository(&mut repository_factory, open_repository);
|
|
||||||
fs.dir_create(&repo_details.gitdir)?;
|
|
||||||
|
|
||||||
//when
|
|
||||||
let (addr, log) = when::start_actor(repository_factory, repo_details, given::a_forge());
|
|
||||||
addr.send(CloneRepo::new()).await?;
|
|
||||||
System::current().stop();
|
|
||||||
|
|
||||||
//then
|
|
||||||
log.require_message_containing("send: RegisterWebhook")?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test_log::test(actix::test)]
|
#[test_log::test(actix::test)]
|
||||||
async fn opened_repo_with_no_default_push_should_not_proceed() -> TestResult {
|
async fn opened_repo_with_no_default_push_should_not_proceed() -> TestResult {
|
||||||
//given
|
//given
|
||||||
|
|
Loading…
Reference in a new issue