Skip to content

Commit 45cf7dc

Browse files
Use --table-style in this test
1 parent cc8950a commit 45cf7dc

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl SharedSettings {
172172
.get_one::<TableStyle>("table_style")
173173
.cloned()
174174
.or(Some(TableStyle::default()))
175-
.unwrap_or(TableStyle::default());
175+
.unwrap_or_default();
176176

177177
Self {
178178
tls: should_use_tls,
@@ -235,7 +235,7 @@ impl SharedSettings {
235235
.get_one::<TableStyle>("table_style")
236236
.cloned()
237237
.or(Some(TableStyle::default()))
238-
.unwrap_or(TableStyle::default());
238+
.unwrap_or_default();
239239

240240
Self {
241241
tls: should_use_tls,
@@ -305,7 +305,7 @@ impl SharedSettings {
305305
.get_one::<TableStyle>("table_style")
306306
.cloned()
307307
.or(Some(TableStyle::default()))
308-
.unwrap_or(TableStyle::default());
308+
.unwrap_or_default();
309309

310310
Self {
311311
tls: should_use_tls,
@@ -367,7 +367,7 @@ impl SharedSettings {
367367
.get_one::<TableStyle>("table_style")
368368
.cloned()
369369
.or(Some(TableStyle::default()))
370-
.unwrap_or(TableStyle::default());
370+
.unwrap_or_default();
371371

372372
Self {
373373
tls: should_use_tls,

tests/users_tests.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,26 @@ fn test_list_users() -> Result<(), Box<dyn std::error::Error>> {
3737

3838
Ok(())
3939
}
40+
41+
#[test]
42+
fn test_list_users_with_table_styles() -> Result<(), Box<dyn std::error::Error>> {
43+
let username = "new_user";
44+
let password = "pa$$w0rd";
45+
run_succeeds([
46+
"declare",
47+
"user",
48+
"--name",
49+
username,
50+
"--password",
51+
password,
52+
]);
53+
54+
run_succeeds(["--table-style", "markdown", "list", "users"])
55+
.stdout(predicate::str::contains(username));
56+
run_succeeds(["delete", "user", "--name", username]);
57+
58+
run_succeeds(["--table-style", "borderless", "list", "users"])
59+
.stdout(predicate::str::contains(username).not());
60+
61+
Ok(())
62+
}

0 commit comments

Comments
 (0)