Skip to content

Commit

Permalink
remove intermediate alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtrystram authored and ctron committed Sep 21, 2021
1 parent a3936aa commit f285251
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion device-management-service/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ where
aliases.insert(TypedAlias("name".into(), device.metadata.name.clone()));

if let Some(Ok(aliases_spec)) = device.section::<registry::v1::DeviceSpecAliases>() {
for alias in aliases_spec.aliases {
for alias in aliases_spec.0 {
aliases.insert(TypedAlias("alias".into(), alias));
}
}
Expand Down
20 changes: 5 additions & 15 deletions device-management-service/tests/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ async fn test_create_device() -> anyhow::Result<()> {
{ "pass": "foo" }
]
},
"alias": {
"aliases": ["baz", "42", "waldo"]
}
"alias": ["baz", "42", "waldo"]
},
})).send_request(&app).await;

Expand Down Expand Up @@ -221,9 +219,7 @@ async fn test_crud_device() -> anyhow::Result<()> {
{"user": {"username": "foo", "password": "bar"}}
]
},
"alias": {
"aliases": ["baz", "42", "waldo"]
}
"alias": ["baz", "42", "waldo"]
}
})).send_request(&app).await;

Expand Down Expand Up @@ -266,9 +262,7 @@ async fn test_crud_device() -> anyhow::Result<()> {
{"user": {"username": "foo", "password": "bar"}}
]
},
"alias": {
"aliases": ["baz", "42", "waldo"]
}
"alias": ["baz", "42", "waldo"]
}
}));

Expand All @@ -284,9 +278,7 @@ async fn test_crud_device() -> anyhow::Result<()> {
{"pass": "foo"},
]
},
"alias": {
"aliases": ["baz"]
}
"alias": ["baz"]
}
})).send_request(&app).await;

Expand Down Expand Up @@ -340,9 +332,7 @@ async fn test_crud_device() -> anyhow::Result<()> {
{"pass": "foo"},
]
},
"alias": {
"aliases": ["baz"]
}
"alias": ["baz"]
}
}));

Expand Down

0 comments on commit f285251

Please sign in to comment.