tests: rename mock variable arun_command

Having a variable named arun_command in tests interferes with tags
generated with ctags: the default tag does not point to the actual
function definition; but to the variable in test_ubuntu_advantage.py.
Excluding the tests when generating the tags would be an option but for
now we'll just rename the variable.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-04-05 10:16:33 +02:00
parent dd788f9eee
commit 9f5d6d9c08
1 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ class TestMockedUAInterfaceStrategy(unittest.TestCase):
class TestUAClientUAInterfaceStrategy(unittest.TestCase):
arun_command = "subiquity.server.ubuntu_advantage.utils.arun_command"
arun_command_sym = "subiquity.server.ubuntu_advantage.utils.arun_command"
def test_init(self):
# Default initializer.
@ -84,7 +84,7 @@ class TestUAClientUAInterfaceStrategy(unittest.TestCase):
"--simulate-with-token", "123456789",
)
with patch(self.arun_command) as mock_arun:
with patch(self.arun_command_sym) as mock_arun:
mock_arun.return_value = CompletedProcess([], 0)
mock_arun.return_value.stdout = "{}"
run_coro(strategy.query_info(token="123456789"))
@ -99,7 +99,7 @@ class TestUAClientUAInterfaceStrategy(unittest.TestCase):
"--simulate-with-token", "123456789",
)
with patch(self.arun_command) as mock_arun:
with patch(self.arun_command_sym) as mock_arun:
mock_arun.side_effect = CalledProcessError(returncode=1,
cmd=command)
mock_arun.return_value.stdout = "{}"
@ -116,7 +116,7 @@ class TestUAClientUAInterfaceStrategy(unittest.TestCase):
"--simulate-with-token", "123456789",
)
with patch(self.arun_command) as mock_arun:
with patch(self.arun_command_sym) as mock_arun:
mock_arun.return_value = CompletedProcess([], 0)
mock_arun.return_value.stdout = "invalid-json"
with self.assertRaises(CheckSubscriptionError):