Files
onefuzz/src/cli/tests/test_serialize.py
bmc-msft 4472d584ac 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"}}`
2021-06-12 14:39:14 +00:00

22 lines
513 B
Python

#!/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()