Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skourta committed Mar 4, 2025
1 parent 1bac948 commit 0287bd2
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions tests/unit/test_data_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def test_set_credentials_secrets_provides_juju3_requires_juju2(self):
), # Data is the diff stored between multiple relation changed events.
"username": "test-username",
"password": "test-password",
"requested-secrets": '["tls-ca"]',
"requested-secrets": '["username", "password", "uris", "tls", "tls-ca", "client-chain"]',
}


Expand Down Expand Up @@ -818,7 +818,7 @@ def test_provider_interface_functions_secrets(self):
self.DATABASE_FIELD: DATABASE,
}
),
"requested-secrets": '["tls-ca"]',
"requested-secrets": '["username", "password", "uris", "tls", "tls-ca", "client-chain"]',
}
}

Expand Down Expand Up @@ -858,7 +858,7 @@ def test_provider_interface_dict_secrets(self):
self.DATABASE_FIELD: DATABASE,
}
),
"requested-secrets": '["tls-ca"]',
"requested-secrets": '["username", "password", "uris", "tls", "tls-ca", "client-chain"]',
self.DATABASE_FIELD: DATABASE,
}

Expand Down Expand Up @@ -982,15 +982,6 @@ def test_set_additional_fields_secrets(self):
secret_id = relation_data.pop(f"{PROV_SECRET_PREFIX}tls")
assert secret_id

relation_data == {
"data": json.dumps(
{REQ_SECRET_FIELDS: self.SECRET_FIELDS, self.DATABASE_FIELD: DATABASE}
), # Data is the diff stored between multiple relation changed events. # noqa
"replset": "rs0",
"version": "1.0",
"uris": "host1:port,host2:port",
}

secret = self.harness.charm.model.get_secret(id=secret_id)
assert secret.peek_content() == {
"tls": "True",
Expand Down Expand Up @@ -1023,15 +1014,6 @@ def test_change_additional_fields_secrets(self, secret_changed_mocked):
secret_id = relation_data.pop(f"{PROV_SECRET_PREFIX}tls")
assert secret_id

relation_data == {
"data": '{REQ_SECRET_FIELDS: "'
+ f"{json.dumps(self.SECRET_FIELDS)}"
+ '"}', # Data is the diff stored between multiple relation changed events. # noqa
"replset": "rs0",
"version": "1.0",
"uris": "host1:port,host2:port",
}

secret = self.harness.charm.model.get_secret(id=secret_id)
assert secret.get_content() == {
"tls": "True",
Expand Down Expand Up @@ -1176,7 +1158,7 @@ def test_fetch_my_relation_data_and_field_secrets(self):
self.DATABASE_FIELD: DATABASE,
}
),
"requested-secrets": '["tls-ca"]',
"requested-secrets": '["username", "password", "uris", "tls", "tls-ca", "client-chain"]',
}
}

Expand Down Expand Up @@ -1966,7 +1948,7 @@ def test_requires_interface_functions_secrets(self):
"alias": "cluster1",
"database": "data_platform",
"extra-user-roles": "CREATEDB,CREATEROLE",
"requested-secrets": '["username", "password", "tls", "tls-ca", "uris"]',
"requested-secrets": '["username", "password", "uris", "tls", "tls-ca", "client-chain"]',
}
}

Expand Down Expand Up @@ -1994,7 +1976,7 @@ def test_requires_interface_dict_secrets(self):
"alias": "cluster1",
"database": "data_platform",
"extra-user-roles": "CREATEDB,CREATEROLE",
"requested-secrets": '["username", "password", "tls", "tls-ca", "uris"]',
"requested-secrets": '["username", "password", "uris", "tls", "tls-ca", "client-chain"]',
}

# Non-leader can try to fetch data (won't have anything thought, as only app data is there...
Expand Down

0 comments on commit 0287bd2

Please sign in to comment.