Skip to content

feat(scope): add description #1093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: test
  • Loading branch information
AugustinMauroy committed May 3, 2025
commit ecb95e91675212bbe3cf98e0dbb7b8f16fcf7088
6 changes: 1 addition & 5 deletions api/src/api/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ use crate::gcp::CACHE_CONTROL_DO_NOT_CACHE;
use crate::iam::ReqIamExt;
use crate::ids::PackageName;
use crate::ids::PackagePath;
use crate::ids::ScopeDescription;
use crate::ids::ScopeName;
use crate::ids::Version;
use crate::metadata::PackageMetadata;
Expand Down Expand Up @@ -2385,10 +2384,7 @@ mod test {
use crate::db::Permissions;
use crate::db::PublishingTaskStatus;
use crate::db::TokenType;
use crate::ids::PackageName;
use crate::ids::PackagePath;
use crate::ids::ScopeName;
use crate::ids::Version;
use crate::ids::{PackageName, PackagePath, ScopeName, Version, ScopeDescription};
use crate::publish::tests::create_mock_tarball;
use crate::publish::tests::process_tarball_setup;
use crate::publish::tests::process_tarball_setup2;
Expand Down
22 changes: 10 additions & 12 deletions api/src/api/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::api::package::package_router;
use crate::emails::EmailArgs;
use crate::emails::EmailSender;
use crate::iam::ReqIamExt;
use crate::ids::ScopeDescription;
use crate::RegistryUrl;
use hyper::Body;
use hyper::Request;
Expand Down Expand Up @@ -501,8 +500,7 @@ pub async fn delete_invite_handler(
#[cfg(test)]
pub mod tests {
use super::*;
use crate::ids::PackageName;
use crate::ids::ScopeName;
use crate::ids::{PackageName, ScopeDescription, ScopeName};
use crate::util::test::ApiResultExt;
use crate::util::test::TestSetup;
use serde_json::json;
Expand All @@ -520,7 +518,7 @@ pub mod tests {
.http()
.post("/api/scopes")
.body_json(
json!({ "scope": "scope1", "description": "Super scope 🐢 !!!" }),
json!({ "scope": "scope1", "description": "" }),
)
.call()
.await
Expand All @@ -536,7 +534,7 @@ pub mod tests {
let mut resp = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "scope1" }))
.body_json(json!({ "scope": "scope1", "description": "" }))
.call()
.await
.unwrap();
Expand All @@ -548,7 +546,7 @@ pub mod tests {
let mut resp = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "scop-e1" }))
.body_json(json!({ "scope": "scop-e1", "description": "" }))
.call()
.await
.unwrap();
Expand All @@ -560,7 +558,7 @@ pub mod tests {
let mut resp = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "scope 1" }))
.body_json(json!({ "scope": "scope 1", "description": "" }))
.call()
.await
.unwrap();
Expand All @@ -571,7 +569,7 @@ pub mod tests {
let mut resp = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "somebadword" }))
.body_json(json!({ "scope": "forbidden", "description": "" })) // Replace "forbidden" with an actual disallowed word from your configuration
.call()
.await
.unwrap();
Expand All @@ -582,7 +580,7 @@ pub mod tests {
let mut resp = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "react" }))
.body_json(json!({ "scope": "react", "description": "" }))
.call()
.await
.unwrap();
Expand All @@ -608,15 +606,15 @@ pub mod tests {
let mut resp = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "scope1" }))
.body_json(json!({ "scope": "scope1", "description": "Super scope 🐢 !!!" }))
.call()
.await
.unwrap();
resp.expect_ok::<ApiScope>().await;
let mut resp: Response<Body> = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "scope2" }))
.body_json(json!({ "scope": "scope2", "description": "Super scope 🐢 !!!" }))
.call()
.await
.unwrap();
Expand All @@ -626,7 +624,7 @@ pub mod tests {
let mut resp: Response<Body> = t
.http()
.post("/api/scopes")
.body_json(json!({ "scope": "scope3" }))
.body_json(json!({ "scope": "scope3", "description": "Another super scope 🐢 !!!" }))
.call()
.await
.unwrap();
Expand Down
4 changes: 1 addition & 3 deletions api/src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,7 @@ mod tests {
use crate::db::NewPackageVersion;
use crate::db::PackageVersionMeta;
use crate::gcp::BigQueryQueryResult;
use crate::ids::PackageName;
use crate::ids::ScopeName;
use crate::ids::Version;
use crate::ids::{PackageName, ScopeDescription, ScopeName, Version};

use super::deserialize_version_download_count_from_bigquery;

Expand Down
2 changes: 1 addition & 1 deletion api/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use crate::github::verify_oidc_token;
use crate::iam::IamInfo;
use crate::iam::ReqIamExt as _;
use crate::ids::PackageName;
use crate::ids::ScopeDescription;
use crate::ids::ScopeName;
use crate::ids::Version;

Expand Down Expand Up @@ -427,6 +426,7 @@ pub mod test {
use crate::errors_internal::ApiErrorStruct;
use crate::gcp::FakeGcsTester;
use crate::util::sanitize_redirect_url;
use crate::ids::ScopeDescription;
use crate::ApiError;
use crate::MainRouterOptions;
use hyper::http::HeaderName;
Expand Down
Loading