Skip to content

Commit a8e1188

Browse files
committed
typosquat/test_util: Replace Owner with Team
There appears to be no reason for the `team()` fn to return an `Owner` instead of a `Team`, aside from the `Owner` being required by the `add_crate_to_team()` fn. But that fn literally has `team` in the name, so it might as well take a `Team` as an argument too :D
1 parent 3fa4876 commit a8e1188

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/typosquat/test_util.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use diesel::{prelude::*, PgConnection};
22

33
use crate::tests::util::github::next_gh_id;
44
use crate::{
5-
models::{Crate, CrateOwner, NewTeam, NewUser, Owner, OwnerKind, User},
5+
models::{Crate, CrateOwner, NewTeam, NewUser, OwnerKind, Team, User},
66
schema::{crate_owners, users},
77
};
88

@@ -15,14 +15,14 @@ pub mod faker {
1515
conn: &mut PgConnection,
1616
user: &User,
1717
krate: &Crate,
18-
team: &Owner,
18+
team: &Team,
1919
) -> anyhow::Result<()> {
2020
// We have to do a bunch of this by hand, since normally adding a team owner triggers
2121
// various checks.
2222
diesel::insert_into(crate_owners::table)
2323
.values(&CrateOwner {
2424
crate_id: krate.id,
25-
owner_id: team.id(),
25+
owner_id: team.id,
2626
created_by: user.id,
2727
owner_kind: OwnerKind::Team,
2828
email_notifications: true,
@@ -47,7 +47,7 @@ pub mod faker {
4747
.map_err(|err| anyhow!(err.to_string()))
4848
}
4949

50-
pub fn team(conn: &mut PgConnection, org: &str, team: &str) -> anyhow::Result<Owner> {
50+
pub fn team(conn: &mut PgConnection, org: &str, team: &str) -> anyhow::Result<Team> {
5151
let login = format!("github:{org}:{team}");
5252
let team = NewTeam::builder()
5353
.login(&login)
@@ -56,7 +56,7 @@ pub mod faker {
5656
.name(team)
5757
.build();
5858

59-
Ok(Owner::Team(team.create_or_update(conn)?))
59+
Ok(team.create_or_update(conn)?)
6060
}
6161

6262
pub fn user(conn: &mut PgConnection, login: &str) -> QueryResult<User> {

0 commit comments

Comments
 (0)