Skip to content

Commit

Permalink
Fill out unauthorized endpoint tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMcFelix committed Dec 28, 2023
1 parent ec3e01e commit 7800b07
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions nexus/tests/integration_tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ lazy_static! {
format!("/v1/network-interfaces?project={}&instance={}", *DEMO_PROJECT_NAME, *DEMO_INSTANCE_NAME);
pub static ref DEMO_INSTANCE_EXTERNAL_IPS_URL: String =
format!("/v1/instances/{}/external-ips?{}", *DEMO_INSTANCE_NAME, *DEMO_PROJECT_SELECTOR);
pub static ref DEMO_INSTANCE_EXTERNAL_IP_ATTACH_URL: String =
format!("/v1/instances/{}/external-ips/attach?{}", *DEMO_INSTANCE_NAME, *DEMO_PROJECT_SELECTOR);
pub static ref DEMO_INSTANCE_EXTERNAL_IP_DETACH_URL: String =
format!("/v1/instances/{}/external-ips/detach?{}", *DEMO_INSTANCE_NAME, *DEMO_PROJECT_SELECTOR);
pub static ref DEMO_INSTANCE_CREATE: params::InstanceCreate =
params::InstanceCreate {
identity: IdentityMetadataCreateParams {
Expand Down Expand Up @@ -592,6 +596,10 @@ lazy_static! {
address: Some(std::net::Ipv4Addr::new(10, 0, 0, 141).into()),
pool: None,
};
pub static ref DEMO_FLOAT_IP_ATTACH: params::ExternalIpCreate =
params::ExternalIpCreate::Floating { floating_ip_name: DEMO_FLOAT_IP_NAME.clone() };
pub static ref DEMO_FLOAT_IP_DETACH: params::ExternalIpDelete =
params::ExternalIpDelete::Floating { floating_ip_name: DEMO_FLOAT_IP_NAME.clone() };
}

lazy_static! {
Expand Down Expand Up @@ -1593,6 +1601,24 @@ lazy_static! {
allowed_methods: vec![AllowedMethod::Get],
},

VerifyEndpoint {
url: &DEMO_INSTANCE_EXTERNAL_IP_ATTACH_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![AllowedMethod::Post(
serde_json::to_value(&*DEMO_FLOAT_IP_ATTACH).unwrap()
)],
},

VerifyEndpoint {
url: &DEMO_INSTANCE_EXTERNAL_IP_DETACH_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![AllowedMethod::Post(
serde_json::to_value(&*DEMO_FLOAT_IP_DETACH).unwrap()
)],
},

/* IAM */

VerifyEndpoint {
Expand Down

0 comments on commit 7800b07

Please sign in to comment.