Skip to content

Commit 9072f3c

Browse files
committed
test_utils: Add github module with next_gh_id() helper
1 parent 2775289 commit 9072f3c

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use std::sync::atomic::{AtomicUsize, Ordering};
2+
3+
static NEXT_GH_ID: AtomicUsize = AtomicUsize::new(1);
4+
5+
pub fn next_gh_id() -> i32 {
6+
NEXT_GH_ID.fetch_add(1, Ordering::SeqCst) as i32
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pub mod builders;
2+
pub mod github;

src/tests/util/github.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@ use crates_io_github::{
33
GitHubError, GitHubOrgMembership, GitHubOrganization, GitHubTeam, GitHubTeamMembership,
44
GitHubUser, MockGitHubClient,
55
};
6-
use std::sync::atomic::{AtomicUsize, Ordering};
76

8-
static NEXT_GH_ID: AtomicUsize = AtomicUsize::new(1);
9-
10-
pub fn next_gh_id() -> i32 {
11-
NEXT_GH_ID.fetch_add(1, Ordering::SeqCst) as i32
12-
}
7+
pub use crates_io_test_utils::github::next_gh_id;
138

149
pub(crate) const MOCK_GITHUB_DATA: MockData = MockData {
1510
orgs: &[MockOrg {

src/typosquat/test_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use diesel::prelude::*;
22

33
use crate::models::{Crate, NewTeam, NewUser, Team, User};
4-
use crate::tests::util::github::next_gh_id;
4+
use crates_io_test_utils::github::next_gh_id;
55

66
pub mod faker {
77
use super::*;

0 commit comments

Comments
 (0)