Skip to content

Commit

Permalink
Merge pull request #140 from filecoin-project/feat/github-wrapper-ins…
Browse files Browse the repository at this point in the history
…tallation-id

Feat/GitHub wrapper installation
  • Loading branch information
AlexMCon authored Mar 8, 2024
2 parents 0f5468b + 3ee08ff commit 7c687c8
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 222 deletions.
17 changes: 9 additions & 8 deletions fplus-database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,22 @@ pub async fn get_database_connection() -> Result<DatabaseConnection, DbErr> {
Err(DbErr::Custom("Database connection is not established".into()))
}
}

/**
* Sets up the initial test environment (database connection and env variables)
*/
pub async fn setup_test_environment() {
init();
setup().await.expect("Failed to setup database connection.");
}

#[cfg(test)]
mod tests {

use super::*;
use tokio;
use serial_test::serial;

/**
* Sets up the initial test environment (database connection and env variables)
*/
async fn setup_test_environment() {
init();
setup().await.expect("Failed to setup database connection.");
}

/**
* Test the establish_connection function
*
Expand Down
5 changes: 3 additions & 2 deletions fplus-lib/src/core/allocator/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use octocrab::models::repos::ContentItems;

use crate::config::get_env_var_or_default;
use crate::{base64::decode_allocator_model, error::LDNError, external_services::github::GithubWrapper};
use crate::external_services::github::github_async_new;
use crate::{base64::decode_allocator_model, error::LDNError};

use self::file::AllocatorModel;

Expand All @@ -14,7 +15,7 @@ pub async fn process_allocator_file(file_name: &str) -> Result<AllocatorModel, L
let branch = "main";
let path = file_name.to_string();

let gh = GithubWrapper::new(owner.to_string(), repo.to_string());
let gh = github_async_new(owner.to_string(), repo.to_string()).await;
let content_items = gh.get_file(&path, branch).await.map_err(|e| LDNError::Load(e.to_string()))?;
let model = content_items_to_allocator_model(content_items).map_err(|e| LDNError::Load(e.to_string()))?;

Expand Down
Loading

0 comments on commit 7c687c8

Please sign in to comment.