20 lines
739 B
Python
20 lines
739 B
Python
import pytest
|
|
from unittest.mock import patch, MagicMock
|
|
import cli
|
|
import sys
|
|
|
|
def test_arg_parsing_default():
|
|
"""Test that default arguments are parsed correctly."""
|
|
with patch.object(sys, 'argv', ['cli.py']):
|
|
args = cli.parse_args()
|
|
assert args.consul_url is None # Should use config default later
|
|
assert args.no_color is False
|
|
|
|
def test_arg_parsing_custom():
|
|
"""Test that custom arguments are parsed correctly."""
|
|
with patch.object(sys, 'argv', ['cli.py', '--consul-url', 'http://custom:8500', '--no-color', '--restart', 'node1']):
|
|
args = cli.parse_args()
|
|
assert args.consul_url == 'http://custom:8500'
|
|
assert args.no_color is True
|
|
assert args.restart == 'node1'
|