File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ use crate::{
77 EncodableOwner , EncodableVersion , GoodCrate ,
88 } ,
99} ;
10- use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
1110
11+ use crate :: tests:: util:: github:: next_gh_id;
1212use diesel:: prelude:: * ;
1313
1414mod account_lock;
@@ -86,11 +86,9 @@ pub struct OkBool {
8686 ok : bool ,
8787}
8888
89- static NEXT_GH_ID : AtomicUsize = AtomicUsize :: new ( 0 ) ;
90-
9189fn new_user ( login : & str ) -> NewUser < ' _ > {
9290 NewUser {
93- gh_id : NEXT_GH_ID . fetch_add ( 1 , Ordering :: SeqCst ) as i32 ,
91+ gh_id : next_gh_id ( ) ,
9492 gh_login : login,
9593 name : None ,
9694 gh_avatar : None ,
@@ -100,8 +98,8 @@ fn new_user(login: &str) -> NewUser<'_> {
10098
10199fn new_team ( login : & str ) -> NewTeam < ' _ > {
102100 NewTeam {
103- org_id : NEXT_GH_ID . fetch_add ( 1 , Ordering :: SeqCst ) as i32 ,
104- github_id : NEXT_GH_ID . fetch_add ( 1 , Ordering :: SeqCst ) as i32 ,
101+ org_id : next_gh_id ( ) ,
102+ github_id : next_gh_id ( ) ,
105103 login,
106104 name : None ,
107105 avatar : None ,
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ use std::net::SocketAddr;
4141use tower:: ServiceExt ;
4242
4343mod chaosproxy;
44- mod github;
44+ pub mod github;
4545pub mod insta;
4646pub mod matchers;
4747mod mock_request;
Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ use crates_io_github::{
55 GitHubTeam , GitHubTeamMembership , GithubUser ,
66} ;
77use oauth2:: AccessToken ;
8+ use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
9+
10+ static NEXT_GH_ID : AtomicUsize = AtomicUsize :: new ( 0 ) ;
11+
12+ pub fn next_gh_id ( ) -> i32 {
13+ NEXT_GH_ID . fetch_add ( 1 , Ordering :: SeqCst ) as i32
14+ }
815
916pub ( crate ) const MOCK_GITHUB_DATA : MockData = MockData {
1017 orgs : & [ MockOrg {
You can’t perform that action at this time.
0 commit comments