mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-21 21:54:26 +00:00
handle serialization of secrets sent from the CLI (#985)
This normalizes the SecretData serialization from the client to address #981. When serializing objects sent to the service with secrets, we would turn it into a SecretData We use SecretData to convert this: `{"auth": {"user": "A", "personal_access_token": "B"}}` to this: `"auth": { "secret": { "url": "https://KEYVAULT-URL" }}` Currently, in the case we have a SecretData we've not yet saved, the serialized form looks like this: `{"auth": { "secret": {"user": "A", "personal_access_token": "B"}}}` This PR simplifies the client side serialization to this: `{"auth": {"user": "A", "personal_access_token": "B"}}`
This commit is contained in:
21
src/cli/tests/test_serialize.py
Normal file
21
src/cli/tests/test_serialize.py
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import unittest
|
||||
|
||||
from onefuzztypes.models import TeamsTemplate
|
||||
|
||||
from onefuzz.backend import serialize
|
||||
|
||||
|
||||
class TestSerialize(unittest.TestCase):
|
||||
def test_cli_backend_secret_data_serialize(self) -> None:
|
||||
base = TeamsTemplate(url="https://contoso.com")
|
||||
converted = serialize(base)
|
||||
self.assertEqual(converted, {"url": "https://contoso.com"})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Reference in New Issue
Block a user