Skip to content

Commit

Permalink
Auto merge of #3851 - Turbo87:underscores, r=hi-rustin
Browse files Browse the repository at this point in the history
Rename `GET /api/private/crate-owner-invitations` to `GET /api/private/crate_owner_invitations`

... because the rest of the API also uses underscores

Addresses #3763 (comment) :)
  • Loading branch information
bors committed Aug 22, 2021
2 parents 6cb6e6d + 0f910bc commit d7fb9d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/controllers/crate_owner_invitation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn list(req: &mut dyn RequestExt) -> EndpointResult {
}))
}

/// Handles the `GET /api/private/crate-owner-invitations` route.
/// Handles the `GET /api/private/crate_owner_invitations` route.
pub fn private_list(req: &mut dyn RequestExt) -> EndpointResult {
let auth = req.authenticate()?.forbid_api_token_auth()?;

Expand Down
2 changes: 1 addition & 1 deletion src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn build_router(app: &App) -> RouteBuilder {

// Crate ownership invitations management in the frontend
router.get(
"/api/private/crate-owner-invitations",
"/api/private/crate_owner_invitations",
C(crate_owner_invitation::private_list),
);

Expand Down
12 changes: 6 additions & 6 deletions src/tests/owners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ fn extract_token_from_invite_email(emails: &Emails) -> String {
#[track_caller]
fn get_invitations(user: &MockCookieUser, query: &str) -> CrateOwnerInvitationsResponse {
user.get_with_query::<CrateOwnerInvitationsResponse>(
"/api/private/crate-owner-invitations",
"/api/private/crate_owner_invitations",
query,
)
.good()
Expand Down Expand Up @@ -1034,7 +1034,7 @@ fn invitations_list_paginated() {
fn invitation_list_with_no_filter() {
let (_, _, owner, _) = TestApp::init().with_token();

let resp = owner.get::<()>("/api/private/crate-owner-invitations");
let resp = owner.get::<()>("/api/private/crate_owner_invitations");
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
assert_eq!(
resp.into_json(),
Expand All @@ -1053,14 +1053,14 @@ fn invitation_list_other_users() {

// Retrieving our own invitations work.
let resp = owner.get_with_query::<()>(
"/api/private/crate-owner-invitations",
"/api/private/crate_owner_invitations",
&format!("invitee_id={}", owner.as_model().id),
);
assert_eq!(resp.status(), StatusCode::OK);

// Retrieving other users' invitations doesn't work.
let resp = owner.get_with_query::<()>(
"/api/private/crate-owner-invitations",
"/api/private/crate_owner_invitations",
&format!("invitee_id={}", other_user.as_model().id),
);
assert_eq!(resp.status(), StatusCode::FORBIDDEN);
Expand All @@ -1077,11 +1077,11 @@ fn invitation_list_other_crates() {

// Retrieving our own invitations work.
let resp =
owner.get_with_query::<()>("/api/private/crate-owner-invitations", "crate_name=crate_1");
owner.get_with_query::<()>("/api/private/crate_owner_invitations", "crate_name=crate_1");
assert_eq!(resp.status(), StatusCode::OK);

// Retrieving other users' invitations doesn't work.
let resp =
owner.get_with_query::<()>("/api/private/crate-owner-invitations", "crate_name=crate_2");
owner.get_with_query::<()>("/api/private/crate_owner_invitations", "crate_name=crate_2");
assert_eq!(resp.status(), StatusCode::FORBIDDEN);
}

0 comments on commit d7fb9d7

Please sign in to comment.