feat: add tests to check for forge types in DB

This commit is contained in:
Aravinth Manivannan 2022-04-12 17:47:34 +05:30
parent e124cb6348
commit d3d2abf074
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -19,23 +19,18 @@
use crate::prelude::*;
/// adding forge works
pub async fn adding_forge_works<T: SCDatabase>(
db: &T,
create_forge_msg: CreateForge<'static>
) {
let _ = db.delete_forge_instance(&create_forge_msg.hostname).await;
db.create_forge_isntance(&create_forge_msg).await.unwrap();
assert!(db.forge_exists(create_forge_msg.hostname).await.unwrap(), "forge creation failed, forge existance check failure");
pub async fn adding_forge_works<T: SCDatabase>(db: &T, create_forge_msg: CreateForge<'static>) {
let _ = db.delete_forge_instance(&create_forge_msg.hostname).await;
db.create_forge_isntance(&create_forge_msg).await.unwrap();
assert!(
db.forge_exists(create_forge_msg.hostname).await.unwrap(),
"forge creation failed, forge existance check failure"
);
}
/// test if all forge type implementations are loaded into DB
pub async fn forge_type_exists_helper<T: SCDatabase>(db: &T) {
for f in [
ForgeImplementation::Gitea
]
.iter()
{
for f in [ForgeImplementation::Gitea].iter() {
println!("Testing forge implementation exists for: {}", f.to_str());
assert!(db.forge_type_exists(f).await.unwrap());
}