test/api: check for 'get-arguments'/api.arguments

Simple check for the new server side method, `get-arguments`, and
client side counterpart, `api.arguments`, that compares that using
the later we get the supplied input (arguments) to API.
This commit is contained in:
Christian Kellner 2020-08-24 23:36:48 +02:00 committed by David Rheinsberg
parent e273dd0084
commit fc5e0070c5

View file

@ -68,6 +68,17 @@ class TestAPI(unittest.TestCase):
with api:
pass
def test_get_arguments(self):
tmpdir = self.tmp.name
path = os.path.join(tmpdir, "osbuild-api")
args = {"options": {"answer": 42}}
monitor = osbuild.monitor.BaseMonitor(sys.stderr.fileno())
with osbuild.api.API(args, monitor, socket_address=path) as _:
data = osbuild.api.arguments(path=path)
self.assertEqual(data, args)
def test_metadata(self):
# Check that `api.metadata` leads to `API.metadata` being
# set correctly