21132: Expand arvados.api_resources docstring with more detail about its purpose
[arvados.git] / sdk / python / tests / test_arv_normalize.py
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 import subprocess
6 import sys
7 import tempfile
8 import unittest
9
10 from . import arvados_testutil as tutil
11
12
13 class ArvNormalizeTestCase(unittest.TestCase, tutil.VersionChecker):
14     def run_arv_normalize(self, args=[]):
15         p = subprocess.Popen([sys.executable, 'bin/arv-normalize'] + args,
16                              stdout=subprocess.PIPE,
17                              stderr=subprocess.PIPE)
18         out, err = p.communicate()
19         sys.stdout.write(out.decode())
20         sys.stderr.write(err.decode())
21         return p.returncode
22
23     def test_unsupported_arg(self):
24         with tutil.redirected_streams(
25                 stdout=tutil.StringIO, stderr=tutil.StringIO) as (out, err):
26             returncode = self.run_arv_normalize(['-x=unknown'])
27         self.assertNotEqual(0, returncode)
28
29     def test_version_argument(self):
30         with tutil.redirected_streams(
31                 stdout=tutil.StringIO, stderr=tutil.StringIO) as (out, err):
32             returncode = self.run_arv_normalize(['--version'])
33         self.assertVersionOutput(out, err)
34         self.assertEqual(0, returncode)