1
# Copyright 2014 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Test AMP argument classes."""
6
from __future__ import (
17
from maastesting.testcase import MAASTestCase
18
from provisioningserver.rpc import arguments
19
from testtools.matchers import (
25
class TestStructureAsJSON(MAASTestCase):
28
"an": "example", "structure": 12.34,
29
"with": None, "and": ["lists", "of", "things"],
30
"and": {"an": "embedded structure"},
33
def test_round_trip(self):
34
argument = arguments.StructureAsJSON()
35
encoded = argument.toString(self.example)
36
self.assertThat(encoded, IsInstance(bytes))
37
decoded = argument.fromString(encoded)
38
self.assertThat(decoded, Equals(self.example))