Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ opt-level = 2
name = "crates_io"
doctest = true

[[test]]
name = "integration"
path = "src/tests/mod.rs"

[dependencies]
aes-gcm = { version = "=0.10.3", features = ["std"] }
anyhow = "=1.0.100"
Expand Down
7 changes: 7 additions & 0 deletions crates/crates_io_test_utils/src/github.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use std::sync::atomic::{AtomicUsize, Ordering};

static NEXT_GH_ID: AtomicUsize = AtomicUsize::new(1);

pub fn next_gh_id() -> i32 {
NEXT_GH_ID.fetch_add(1, Ordering::SeqCst) as i32
}
18 changes: 18 additions & 0 deletions crates/crates_io_test_utils/src/helpers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use crates_io_database::models::{Crate, CrateOwner, Team, User};
use diesel::prelude::*;
use diesel_async::AsyncPgConnection;

pub async fn add_team_to_crate(
t: &Team,
krate: &Crate,
u: &User,
conn: &mut AsyncPgConnection,
) -> QueryResult<()> {
CrateOwner::builder()
.crate_id(krate.id)
.team_id(t.id)
.created_by(u.id)
.build()
.insert(conn)
.await
}
2 changes: 2 additions & 0 deletions crates/crates_io_test_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pub mod builders;
pub mod github;
pub mod helpers;
Loading