style: cargo fmt --all
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
use std::sync::Arc;
|
||||
use application::testing::InMemoryPluginRepository;
|
||||
use application::processing::{ManagePluginCommand, ManagePluginHandler, PluginAction};
|
||||
use application::testing::InMemoryPluginRepository;
|
||||
use domain::entities::{Plugin, PluginType};
|
||||
use domain::ports::PluginRepository;
|
||||
use domain::value_objects::StructuredData;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
async fn creates_plugin() {
|
||||
let plugin_repo = Arc::new(InMemoryPluginRepository::new());
|
||||
let handler = ManagePluginHandler::new(plugin_repo.clone());
|
||||
|
||||
let plugin = handler.execute(ManagePluginCommand {
|
||||
plugin_id: None,
|
||||
action: PluginAction::Create {
|
||||
name: "EXIF Extractor".into(),
|
||||
plugin_type: PluginType::MediaProcessor,
|
||||
config: StructuredData::new(),
|
||||
},
|
||||
}).await.unwrap();
|
||||
let plugin = handler
|
||||
.execute(ManagePluginCommand {
|
||||
plugin_id: None,
|
||||
action: PluginAction::Create {
|
||||
name: "EXIF Extractor".into(),
|
||||
plugin_type: PluginType::MediaProcessor,
|
||||
config: StructuredData::new(),
|
||||
},
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(plugin.name, "EXIF Extractor");
|
||||
assert_eq!(plugin.plugin_type, PluginType::MediaProcessor);
|
||||
@@ -36,10 +39,13 @@ async fn enables_plugin() {
|
||||
plugin_repo.save(&plugin).await.unwrap();
|
||||
|
||||
let handler = ManagePluginHandler::new(plugin_repo.clone());
|
||||
let result = handler.execute(ManagePluginCommand {
|
||||
plugin_id: Some(plugin_id),
|
||||
action: PluginAction::Enable,
|
||||
}).await.unwrap();
|
||||
let result = handler
|
||||
.execute(ManagePluginCommand {
|
||||
plugin_id: Some(plugin_id),
|
||||
action: PluginAction::Enable,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(result.is_enabled);
|
||||
}
|
||||
@@ -52,10 +58,13 @@ async fn disables_plugin() {
|
||||
plugin_repo.save(&plugin).await.unwrap();
|
||||
|
||||
let handler = ManagePluginHandler::new(plugin_repo.clone());
|
||||
let result = handler.execute(ManagePluginCommand {
|
||||
plugin_id: Some(plugin_id),
|
||||
action: PluginAction::Disable,
|
||||
}).await.unwrap();
|
||||
let result = handler
|
||||
.execute(ManagePluginCommand {
|
||||
plugin_id: Some(plugin_id),
|
||||
action: PluginAction::Disable,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(!result.is_enabled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user