Skip to content

Commit abe739a

Browse files
author
Timmy Welch
committed
Update existing tests for new MaskString
1 parent 6deb33a commit abe739a

12 files changed

Lines changed: 20 additions & 20 deletions

File tree

tests/facts/mysql.MysqlDatabases/multiple_custom_connection.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"arg": ["myuser", "mypassword", "myhost", "myport"],
33
"command": {
4-
"raw": "mysql -u\"myuser\" -p\"mypassword\" -hmyhost -Pmyport -Be 'SELECT * FROM information_schema.SCHEMATA'",
5-
"masked": "mysql -u\"myuser\" *** -hmyhost -Pmyport -Be 'SELECT * FROM information_schema.SCHEMATA'"
4+
"raw": "mysql -u\"myuser\" -pmypassword -hmyhost -Pmyport -Be 'SELECT * FROM information_schema.SCHEMATA'",
5+
"masked": "mysql -u\"myuser\" -p'*MASKED*' -hmyhost -Pmyport -Be 'SELECT * FROM information_schema.SCHEMATA'"
66
},
77
"requires_command": "mysql",
88
"output": [

tests/facts/postgresql.PostgresqlRoles/multiple_custom_connection.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"arg": ["myuser", "mypassword", "myhost", "myport"],
33
"command": {
4-
"raw": "PGPASSWORD=\"mypassword\" psql -U myuser -h myhost -p myport -Ac 'SELECT * FROM pg_catalog.pg_roles'",
5-
"masked": "*** psql -U myuser -h myhost -p myport -Ac 'SELECT * FROM pg_catalog.pg_roles'"
4+
"raw": "PGPASSWORD=mypassword psql -U myuser -h myhost -p myport -Ac 'SELECT * FROM pg_catalog.pg_roles'",
5+
"masked": "PGPASSWORD='*MASKED*' psql -U myuser -h myhost -p myport -Ac 'SELECT * FROM pg_catalog.pg_roles'"
66
},
77
"requires_command": "psql",
88
"output": [

tests/operations/mysql.dump/dump.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
},
88
"commands": [
99
{
10-
"raw": "mysqldump somedb -u\"root\" -p\"somepass\" > somefile",
11-
"masked": "mysqldump somedb -u\"root\" *** > somefile"
10+
"raw": "mysqldump somedb -u\"root\" -psomepass > somefile",
11+
"masked": "mysqldump somedb -u\"root\" -p'*MASKED*' > somefile"
1212
}
1313
],
1414
"idempotent": false

tests/operations/mysql.sql/execute_mysql_kwargs.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
},
99
"commands": [
1010
{
11-
"raw": "mysql -u\"someuser\" -p\"somepass\" -h127.0.0.1 -P100 -Be 'SELECT 1'",
12-
"masked": "mysql -u\"someuser\" *** -h127.0.0.1 -P100 -Be 'SELECT 1'"
11+
"raw": "mysql -u\"someuser\" -psomepass -h127.0.0.1 -P100 -Be 'SELECT 1'",
12+
"masked": "mysql -u\"someuser\" -p'*MASKED*' -h127.0.0.1 -P100 -Be 'SELECT 1'"
1313
}
1414
],
1515
"idempotent": false

tests/operations/mysql.user/add_password.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"commands": [
1313
{
1414
"raw": "mysql -Be 'CREATE USER \"someuser\"@\"localwhat\" IDENTIFIED BY \"mypass\"'",
15-
"masked": "mysql -Be 'CREATE USER \"someuser\"@\"localwhat\" ***'"
15+
"masked": "mysql -Be 'CREATE USER \"someuser\"@\"localwhat\" IDENTIFIED BY \"*MASKED*\"'"
1616
}
1717
]
1818
}

tests/operations/postgresql.dump/dump.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
},
1010
"commands": [
1111
{
12-
"raw": "PGPASSWORD=\"somepass\" pg_dump -d somedb -U root -h localhost -p 3306 > somefile",
13-
"masked": "*** pg_dump -d somedb -U root -h localhost -p 3306 > somefile"
12+
"raw": "PGPASSWORD=somepass pg_dump -d somedb -U root -h localhost -p 3306 > somefile",
13+
"masked": "PGPASSWORD='*MASKED*' pg_dump -d somedb -U root -h localhost -p 3306 > somefile"
1414
}
1515
],
1616
"idempotent": false

tests/operations/postgresql.load/load.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
},
88
"commands": [
99
{
10-
"raw": "PGPASSWORD=\"somepass\" psql -d somedb -U root < somefile",
11-
"masked": "*** psql -d somedb -U root < somefile"
10+
"raw": "PGPASSWORD=somepass psql -d somedb -U root < somefile",
11+
"masked": "PGPASSWORD='*MASKED*' psql -d somedb -U root < somefile"
1212
}
1313
],
1414
"idempotent": false

tests/operations/postgresql.role/role_update.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"commands": [
1717
{
1818
"raw": "psql -Ac 'ALTER ROLE \"testuser\" CONNECTION LIMIT 15 PASSWORD '\"'\"'abc'\"'\"''",
19-
"masked":"psql -Ac 'ALTER ROLE \"testuser\" CONNECTION LIMIT 15 ***'"
19+
"masked":"psql -Ac 'ALTER ROLE \"testuser\" CONNECTION LIMIT 15 PASSWORD '\"'\"'*MASKED*'\"'\"''"
2020
}
2121
]
2222

tests/operations/postgresql.role/user_add.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"commands": [
1313
{
1414
"raw": "psql -Ac 'CREATE ROLE \"testuser\" LOGIN CONNECTION LIMIT 15 PASSWORD '\"'\"'abc'\"'\"''",
15-
"masked":"psql -Ac 'CREATE ROLE \"testuser\" LOGIN CONNECTION LIMIT 15 ***'"
15+
"masked":"psql -Ac 'CREATE ROLE \"testuser\" LOGIN CONNECTION LIMIT 15 PASSWORD '\"'\"'*MASKED*'\"'\"''"
1616
}
1717
]
1818
}

tests/test_api/test_api_command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ def test_normal(self):
3636
def test_masked(self):
3737
cmd = StringCommand(MaskString("adsfg"))
3838
assert cmd.get_raw_value() == "adsfg"
39-
assert str(cmd) == "***"
39+
assert str(cmd) == "*MASKED*"
4040

4141
def test_mixed_masked(self):
4242
cmd = StringCommand("some", "stuff", MaskString("mask me"), "other", "stuff")
4343
assert cmd.get_raw_value() == "some stuff mask me other stuff"
44-
assert str(cmd) == "some stuff *** other stuff"
44+
assert str(cmd) == "some stuff *MASKED* other stuff"
4545

4646
def test_nested(self):
4747
nested_cmd = StringCommand("some", "stuff")
@@ -130,7 +130,7 @@ def test_quoted_arg(self):
130130
def test_masked_arg(self):
131131
cmd = make_formatted_string_command("echo {0}", MaskString("secret"))
132132
assert cmd.get_raw_value() == "echo secret"
133-
assert str(cmd) == "echo ***"
133+
assert str(cmd) == "echo *MASKED*"
134134

135135
def test_path_with_multiple_segments(self):
136136
cmd = make_formatted_string_command("ls /{0}/{1}/{2}", "home", "user", "docs")

0 commit comments

Comments
 (0)