mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-21 13:51:19 +00:00
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"}}`
22 lines
513 B
Python
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()
|