summaryrefslogtreecommitdiff
path: root/rust/tests
diff options
context:
space:
mode:
authorRubens Brandao <git@rubens.io>2024-06-20 09:15:03 -0300
committerMason Reed <mason@vector35.com>2025-02-06 22:54:17 -0500
commitfe3ed7630079c1166bb4529100ffa7c4ae97a130 (patch)
tree291a7978f66f91bec1e2b6c44c823d34895b8652 /rust/tests
parent4075371ae3e3b7f0f7d42be3b83dbd4bc83fdfb5 (diff)
Implement Rust Repository
Diffstat (limited to 'rust/tests')
-rw-r--r--rust/tests/repository.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/rust/tests/repository.rs b/rust/tests/repository.rs
new file mode 100644
index 00000000..6047bcae
--- /dev/null
+++ b/rust/tests/repository.rs
@@ -0,0 +1,30 @@
+use binaryninja::headless::Session;
+use binaryninja::repository::RepositoryManager;
+use rstest::*;
+
+#[fixture]
+fn session() -> Session {
+ Session::new().expect("Failed to initialize session")
+}
+
+#[rstest]
+fn test_list(_session: Session) {
+ let manager = RepositoryManager::default();
+ let repositories = manager.repositories();
+ for repository in &repositories {
+ let repo_path = repository.path();
+ let repository_by_path = manager.repository_by_path(repo_path).unwrap();
+ assert_eq!(repository.url(), repository_by_path.url());
+ }
+
+ let repository = manager.default_repository();
+ let _full_path = repository.full_path();
+ let _path = repository.path();
+ let _url = repository.url();
+ let plugins = repository.plugins();
+ for plugin in &plugins {
+ let plugin_path = plugin.path();
+ let plugin_by_path = repository.plugin_by_path(plugin_path).unwrap();
+ assert_eq!(plugin.package_url(), plugin_by_path.package_url());
+ }
+}