project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
aws-deadline_deadline-cloud
public
public
0
0
test_cli_bundle_warning_suppression
def test_cli_bundle_warning_suppression(fresh_deadline_config, temp_job_bundle_dir):"""Test that warnings are suppressed for paths in known_asset_paths."""# Set up configurationconfig.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("settings.auto_accept", "false")# Write a JSON templatewith open(os.path.join(temp_job_bundle_dir, "template.json"), "w", encoding="utf8") as f:f.write(MOCK_JOB_TEMPLATE_CASES["MINIMAL_JSON"][1])# Create a file in the job bundle directoryjob_bundle_file_path = os.path.join(temp_job_bundle_dir, "test_file.txt")with open(job_bundle_file_path, "wb") as f:f.write(b"test content")# Create a file outside the job bundle directorywith tempfile.NamedTemporaryFile(delete=False) as temp_file:temp_file.write(b"test content")external_file_path = temp_file.nametry:# Create asset references pointing to the external filewith open(os.path.join(temp_job_bundle_dir, "asset_references.json"), "w", encoding="utf8") as f:json.dump({"assetReferences": {"inputs": {"filenames": [external_file_path, job_bundle_file_path],"directories": [],},"outputs": {"directories": []},}},f,)with patch_calls_for_create_job_from_job_bundle():# First test: without known_asset_path - should show warning and succeed when user confirmswith patch.object(click, "confirm", return_value=True) as mock_confirm:runner = CliRunner()result = runner.invoke(main,["bundle","submit",temp_job_bundle_dir,],)# Verify warning was shownassert result.exit_code == 0, result.outputmock_confirm.assert_called_once_with(ANY, default=False)# The warning message should say there are two input files, but only one has an issuewarning_message = mock_confirm.call_args[0][0]assert "Job submission contains 2 input files" in warning_message, warning_messageassert (f"Unknown locations for upload:\n{external_file_path}" in warning_message), warning_message# Second test: without known_asset_path - should show warning and fail when user cancelswith patch.object(click, "confirm", return_value=False) as mock_confirm:runner = CliRunner()result = runner.invoke(main,["bundle","submit",temp_job_bundle_dir,],)# Verify warning was shownassert result.exit_code == 1, result.outputmock_confirm.assert_called_once_with(ANY, default=False)# The warning message should say there are two input files, but only one has an issuewarning_message = mock_confirm.call_args[0][0]assert "Job submission contains 2 input files" in warning_message, warning_messageassert (f"Unknown locations for upload:\n{external_file_path}" in warning_message), warning_message# Third test: with known_asset_path - should not show warningwith patch.object(click, "confirm", return_value=True) as mock_confirm:runner = CliRunner()result = runner.invoke(main,["bundle","submit",temp_job_bundle_dir,"--known-asset-path",os.path.dirname(external_file_path),],)# Verify warning was not shownassert result.exit_code == 0, result.outputmock_confirm.assert_called_once_with(ANY, default=True)finally:# Clean up the temporary fileos.unlink(external_file_path)
2
79
2
439
5
255
360
255
fresh_deadline_config,temp_job_bundle_dir
['job_bundle_file_path', 'warning_message', 'runner', 'result', 'external_file_path']
None
{"Assign": 10, "Expr": 12, "Try": 1, "With": 8}
29
106
29
["config.set_setting", "config.set_setting", "config.set_setting", "open", "os.path.join", "f.write", "os.path.join", "open", "f.write", "tempfile.NamedTemporaryFile", "temp_file.write", "open", "os.path.join", "json.dump", "patch_calls_for_create_job_from_job_bundle", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "patch.object", "CliRunner", "runner.invoke", "os.path.dirname", "mock_confirm.assert_called_once_with", "os.unlink"]
0
[]
The function (test_cli_bundle_warning_suppression) defined within the public class called public.The function start at line 255 and ends at 360. It contains 79 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [255.0] and does not return any value. It declares 29.0 functions, and It has 29.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "open", "os.path.join", "f.write", "os.path.join", "open", "f.write", "tempfile.NamedTemporaryFile", "temp_file.write", "open", "os.path.join", "json.dump", "patch_calls_for_create_job_from_job_bundle", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "patch.object", "CliRunner", "runner.invoke", "os.path.dirname", "mock_confirm.assert_called_once_with", "os.unlink"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_config_show_defaults
def test_cli_config_show_defaults(fresh_deadline_config):"""Confirm that the CLI interface prints out all the configurationfile data, when the configuration is default"""runner = CliRunner()result = runner.invoke(main, ["config", "show"])assert result.exit_code == 0settings = config_file.SETTINGS# The command prints out the full config file pathassert fresh_deadline_config in result.output# Assert the expected number of settingsassert len(settings.keys()) == 16for setting_name in settings.keys():assert setting_name in result.outputassert str(config_file.get_setting_default(setting_name)) in result.output
2
10
1
82
3
22
42
22
fresh_deadline_config
['runner', 'result', 'settings']
None
{"Assign": 3, "Expr": 1, "For": 1}
7
21
7
["CliRunner", "runner.invoke", "len", "settings.keys", "settings.keys", "str", "config_file.get_setting_default"]
0
[]
The function (test_cli_config_show_defaults) defined within the public class called public.The function start at line 22 and ends at 42. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["CliRunner", "runner.invoke", "len", "settings.keys", "settings.keys", "str", "config_file.get_setting_default"].
aws-deadline_deadline-cloud
public
public
0
0
test_default_log_level
def test_default_log_level(fresh_deadline_config):"""We must make sure that DEBUG is not the default log level"""assert config.get_setting("settings.log_level") == "WARNING"assert config.get_setting_default("settings.log_level") == "WARNING"
1
3
1
24
0
45
48
45
fresh_deadline_config
[]
None
{"Expr": 1}
2
4
2
["config.get_setting", "config.get_setting_default"]
0
[]
The function (test_default_log_level) defined within the public class called public.The function start at line 45 and ends at 48. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["config.get_setting", "config.get_setting_default"].
aws-deadline_deadline-cloud
public
public
0
0
test_log_level_updated
def test_log_level_updated(fresh_deadline_config, caplog, log_level):"""Tests that the logging level is set to debug"""# GIVENconfig.set_setting("settings.log_level", log_level)with caplog.at_level(logging.DEBUG), patch.object(deadline.client.cli._main.logging, "basicConfig") as mock_basic_config:# WHENCliRunner().invoke(deadline.client.cli._main.main, ["config", "show"])# THENassert (f"Log Level '{log_level}' not in ['ERROR', 'WARNING', 'INFO', 'DEBUG']. Defaulting to WARNING"in caplog.text) == (log_level == "NOT_A_LOG_LEVEL")# This only ever gets logged if the log_level passed into click is DEBUGassert ("Debug logging is on" in caplog.text) == (log_level == "DEBUG")mock_basic_config.assert_called_once_with(level=log_level if log_level != "NOT_A_LOG_LEVEL" else "WARNING")
2
14
3
112
0
61
81
61
fresh_deadline_config,caplog,log_level
[]
None
{"Expr": 4, "With": 1}
7
21
7
["config.set_setting", "caplog.at_level", "patch.object", "invoke", "CliRunner", "mock_basic_config.assert_called_once_with", "pytest.mark.parametrize"]
0
[]
The function (test_log_level_updated) defined within the public class called public.The function start at line 61 and ends at 81. It contains 14 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [61.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["config.set_setting", "caplog.at_level", "patch.object", "invoke", "CliRunner", "mock_basic_config.assert_called_once_with", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_config_show_modified_config
def test_cli_config_show_modified_config(fresh_deadline_config):"""Confirm that the CLI interface prints out all the configurationfile data, when the configuration is default"""config.set_setting("deadline-cloud-monitor.path", "/User/auser/bin/DeadlineCloudMonitor")config.set_setting("defaults.aws_profile_name", "EnvVarOverrideProfile")config.set_setting("settings.job_history_dir", "~/alternate/job_history")config.set_setting("defaults.farm_id", "farm-82934h23k4j23kjh")config.set_setting("settings.storage_profile_id", "sp-12345abcde12345")config.set_setting("defaults.queue_id", "queue-389348u234jhk34")config.set_setting("defaults.job_id", "job-239u40234jkl234nkl23")config.set_setting("settings.auto_accept", "False")config.set_setting("settings.conflict_resolution", "CREATE_COPY")config.set_setting("defaults.job_attachments_file_system", "VIRTUAL")config.set_setting("settings.log_level", "DEBUG")config.set_setting("telemetry.opt_out", "True")config.set_setting("telemetry.identifier", "user-id-123abc-456def")config.set_setting("settings.s3_max_pool_connections", "100")config.set_setting("settings.small_file_threshold_multiplier", "15")config.set_setting("settings.known_asset_paths", "/known/asset/path")runner = CliRunner()result = runner.invoke(main, ["config", "show"])assert result.exit_code == 0, result.output# We should see all the overridden values in the outputassert "EnvVarOverrideProfile" in result.outputassert "~/alternate/job_history" in result.outputassert result.output.count("False") == 1assert result.output.count("True") == 1assert "farm-82934h23k4j23kjh" in result.outputassert "queue-389348u234jhk34" in result.outputassert "job-239u40234jkl234nkl23" in result.outputassert "CREATE_COPY" in result.outputassert "DEBUG" in result.outputassert "user-id-123abc-456def" in result.outputassert "/known/asset/path" in result.output# It shouldn't say anywhere that there is a default settingassert "(default)" not in result.output
1
32
1
246
2
84
124
84
fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 17}
20
41
20
["config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "CliRunner", "runner.invoke", "result.output.count", "result.output.count"]
0
[]
The function (test_cli_config_show_modified_config) defined within the public class called public.The function start at line 84 and ends at 124. It contains 32 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 20.0 functions, and It has 20.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "CliRunner", "runner.invoke", "result.output.count", "result.output.count"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_config_show_json_output
def test_cli_config_show_json_output(fresh_deadline_config):"""Confirm that the CLI interface prints out all the configurationfile data, when the configuration is default"""runner = CliRunner()result = runner.invoke(main, ["config", "show", "--output", "json"])assert result.exit_code == 0expected_output = {}for setting_name in config.config_file.SETTINGS.keys():expected_output[setting_name] = config.config_file.get_setting(setting_name)expected_output["settings.config_file_path"] = str(config.config_file.get_config_file_path())assert json.loads(result.output) == expected_output
2
9
1
91
3
127
142
127
fresh_deadline_config
['expected_output', 'runner', 'result']
None
{"Assign": 5, "Expr": 1, "For": 1}
7
16
7
["CliRunner", "runner.invoke", "config.config_file.SETTINGS.keys", "config.config_file.get_setting", "str", "config.config_file.get_config_file_path", "json.loads"]
0
[]
The function (test_cli_config_show_json_output) defined within the public class called public.The function start at line 127 and ends at 142. It contains 9 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["CliRunner", "runner.invoke", "config.config_file.SETTINGS.keys", "config.config_file.get_setting", "str", "config.config_file.get_config_file_path", "json.loads"].
aws-deadline_deadline-cloud
public
public
0
0
test_config_settings_via_cli_roundtrip
def test_config_settings_via_cli_roundtrip(fresh_deadline_config, setting_name, default_value, alternate_value):"""Test that each setting we support has the right default and roundtrips changes when called via CLI"""runner = CliRunner()result = runner.invoke(main, ["config", "get", setting_name])assert result.exit_code == 0assert result.output.strip() == str(default_value)result = runner.invoke(main, ["config", "set", setting_name, str(alternate_value)])assert result.exit_code == 0assert result.output.strip() == ""result = runner.invoke(main, ["config", "get", setting_name])assert result.exit_code == 0assert result.output.strip() == str(alternate_value)result = runner.invoke(main, ["config", "clear", setting_name])assert result.exit_code == 0assert result.output.strip() == ""result = runner.invoke(main, ["config", "get", setting_name])assert result.exit_code == 0assert result.output.strip() == str(default_value)
1
19
4
191
2
146
171
146
fresh_deadline_config,setting_name,default_value,alternate_value
['runner', 'result']
None
{"Assign": 6, "Expr": 1}
16
26
16
["CliRunner", "runner.invoke", "result.output.strip", "str", "runner.invoke", "str", "result.output.strip", "runner.invoke", "result.output.strip", "str", "runner.invoke", "result.output.strip", "runner.invoke", "result.output.strip", "str", "pytest.mark.parametrize"]
0
[]
The function (test_config_settings_via_cli_roundtrip) defined within the public class called public.The function start at line 146 and ends at 171. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [146.0] and does not return any value. It declares 16.0 functions, and It has 16.0 functions called inside which are ["CliRunner", "runner.invoke", "result.output.strip", "str", "runner.invoke", "str", "result.output.strip", "runner.invoke", "result.output.strip", "str", "runner.invoke", "result.output.strip", "runner.invoke", "result.output.strip", "str", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_config_set_setting_nonexistant
def test_config_set_setting_nonexistant(fresh_deadline_config):"""Test that we get an error with a non-existent setting."""runner = CliRunner()result = runner.invoke(main, ["config", "set", "settings.doesnt_exist", "value"])assert result.exit_code == 1assert "doesnt_exist" in result.output
1
5
1
41
2
174
181
174
fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
2
8
2
["CliRunner", "runner.invoke"]
0
[]
The function (test_config_set_setting_nonexistant) defined within the public class called public.The function start at line 174 and ends at 181. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_config_command_setting_nonexistant
def test_config_command_setting_nonexistant(config_command, fresh_deadline_config):"""Test that we get an error with a non-existent setting."""runner = CliRunner()result = runner.invoke(main, ["config", config_command, "settings.doesnt_exist"])assert result.exit_code == 1assert "doesnt_exist" in result.output
1
5
2
41
2
197
204
197
config_command,fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
5
8
5
["CliRunner", "runner.invoke", "pytest.mark.parametrize", "pytest.param", "pytest.param"]
0
[]
The function (test_config_command_setting_nonexistant) defined within the public class called public.The function start at line 197 and ends at 204. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [197.0] and does not return any value. It declares 5.0 functions, and It has 5.0 functions called inside which are ["CliRunner", "runner.invoke", "pytest.mark.parametrize", "pytest.param", "pytest.param"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_farm_list
def test_cli_farm_list(fresh_deadline_config, mock_telemetry):"""Confirm that the CLI interface prints out the expected list offarms, given mock data."""with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").list_farms.return_value = {"farms": MOCK_FARMS_LIST}runner = CliRunner()result = runner.invoke(main, ["farm", "list"])assert (result.output== """- farmId: farm-0123456789abcdef0123456789abcdefdisplayName: Testing Farm- farmId: farm-0123456789abcdef0123456789abcdegdisplayName: Another Farm""")assert result.exit_code == 0
1
9
2
73
2
33
53
33
fresh_deadline_config,mock_telemetry
['runner', 'result']
None
{"Assign": 3, "Expr": 1, "With": 1}
5
21
5
["patch.object", "client", "session_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_farm_list) defined within the public class called public.The function start at line 33 and ends at 53. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [33.0] and does not return any value. It declares 5.0 functions, and It has 5.0 functions called inside which are ["patch.object", "client", "session_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_farm_list_override_profile
def test_cli_farm_list_override_profile(fresh_deadline_config):"""Confirms that the --profile option overrides the option to boto3.Session."""# set the "user identities" property to True so it doesn't probe the boto3.Session# for configuration.config.set_setting("defaults.aws_profile_name", "NonDefaultProfileName")config.set_setting("defaults.aws_profile_name", "DifferentProfileName")with patch.object(boto3, "Session") as session_mock:session_mock().client("deadline").list_farms.return_value = {"farms": MOCK_FARMS_LIST}session_mock()._session.get_scoped_config().get.return_value = "some-monitor-id"session_mock.reset_mock()runner = CliRunner()result = runner.invoke(main, ["farm", "list", "--profile", "NonDefaultProfileName"])assert result.exit_code == 0session_mock.assert_called_with(profile_name="NonDefaultProfileName")session_mock().client().list_farms.assert_called_once_with()
1
12
1
122
2
56
75
56
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 6, "With": 1}
14
20
14
["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "_session.get_scoped_config", "session_mock", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_with", "list_farms.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_farm_list_override_profile) defined within the public class called public.The function start at line 56 and ends at 75. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 14.0 functions, and It has 14.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "_session.get_scoped_config", "session_mock", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_with", "list_farms.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_farm_list_client_error
def test_cli_farm_list_client_error(fresh_deadline_config):with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").list_farms.side_effect = ClientError({"Error": {"Message": "A botocore client error"}}, "client error")runner = CliRunner()result = runner.invoke(main, ["farm", "list"])assert "Failed to get Farms" in result.outputassert "A botocore client error" in result.outputassert result.exit_code != 0
1
10
1
83
2
78
89
78
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "With": 1}
6
12
6
["patch.object", "client", "session_mock", "ClientError", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_farm_list_client_error) defined within the public class called public.The function start at line 78 and ends at 89. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["patch.object", "client", "session_mock", "ClientError", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_farm_get
def test_cli_farm_get(fresh_deadline_config, mock_telemetry):"""Confirm that the CLI interface prints out the expected farm, given mock data."""config.set_setting("defaults.farm_id", "farm-0123456789abcdef0123456789abcdef")with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_farm.return_value = MOCK_FARMS_LIST[0]runner = CliRunner()result = runner.invoke(main, ["farm", "get"])assert (result.output== """farmId: farm-0123456789abcdef0123456789abcdefdescription: A Description.displayName: Testing Farm""")assert result.exit_code == 0session_mock().client("deadline").get_farm.assert_called_once_with(farmId="farm-0123456789abcdef0123456789abcdef")
1
13
2
97
2
92
115
92
fresh_deadline_config,mock_telemetry
['runner', 'result']
None
{"Assign": 3, "Expr": 3, "With": 1}
9
24
9
["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_farm.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_farm_get) defined within the public class called public.The function start at line 92 and ends at 115. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [92.0] and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_farm.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_farm_get_override_profile
def test_cli_farm_get_override_profile(fresh_deadline_config):"""Confirms that the --profile option overrides the option to boto3.Session."""# set the farm id for the overridden profileconfig.set_setting("defaults.aws_profile_name", "NonDefaultProfileName")config.set_setting("defaults.farm_id", "farm-overriddenid")config.set_setting("defaults.aws_profile_name", "DifferentProfileName")with patch.object(boto3, "Session") as session_mock:session_mock().client("deadline").get_farm.return_value = MOCK_FARMS_LIST[0]session_mock.reset_mock()runner = CliRunner()result = runner.invoke(main, ["farm", "get", "--profile", "NonDefaultProfileName"])assert result.exit_code == 0session_mock.assert_called_once_with(profile_name="NonDefaultProfileName")session_mock().client().get_farm.assert_called_once_with(farmId="farm-overriddenid")
1
12
1
117
2
118
136
118
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 7, "With": 1}
13
19
13
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_once_with", "get_farm.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_farm_get_override_profile) defined within the public class called public.The function start at line 118 and ends at 136. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 13.0 functions, and It has 13.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_once_with", "get_farm.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_farm_get_no_default_set
def test_cli_farm_get_no_default_set(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected farm, given mock data."""with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_farm.return_value = MOCK_FARMS_LIST[0]runner = CliRunner()result = runner.invoke(main, ["farm", "get"])assert "Missing '--farm-id' or default Farm ID configuration" in result.outputassert result.exit_code != 0
1
7
1
68
2
139
151
139
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 1, "With": 1}
5
13
5
["patch.object", "client", "session_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_farm_get_no_default_set) defined within the public class called public.The function start at line 139 and ends at 151. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 functions called inside which are ["patch.object", "client", "session_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_farm_get_explicit_farm_id
def test_cli_farm_get_explicit_farm_id(fresh_deadline_config, mock_telemetry):"""Confirm that the CLI interface prints out the expected farm, given mock data."""with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_farm.return_value = MOCK_FARMS_LIST[0]runner = CliRunner()result = runner.invoke(main,["farm", "get", "--farm-id", "farm-0123456789abcdef0123456789abcdef"],)assert (result.output== """farmId: farm-0123456789abcdef0123456789abcdefdescription: A Description.displayName: Testing Farm""")assert result.exit_code == 0session_mock().client("deadline").get_farm.assert_called_once_with(farmId="farm-0123456789abcdef0123456789abcdef")
1
15
2
94
2
154
179
154
fresh_deadline_config,mock_telemetry
['runner', 'result']
None
{"Assign": 3, "Expr": 2, "With": 1}
8
26
8
["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_farm.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_farm_get_explicit_farm_id) defined within the public class called public.The function start at line 154 and ends at 179. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [154.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_farm.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_list
def test_cli_fleet_list(fresh_deadline_config, mock_telemetry):"""Confirm that the CLI interface prints out the expected list offleets, given mock data."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").list_fleets.return_value = {"fleets": MOCK_FLEETS_LIST}runner = CliRunner()result = runner.invoke(main, ["fleet", "list"])assert (result.output== """- fleetId: fleet-0123456789abcdef0123456789abcdefdisplayName: MadFleet- fleetId: fleet-0223456789abcdef0223456789abcdefdisplayName: MadderFleet""")assert result.exit_code == 0
1
10
2
81
2
53
75
53
fresh_deadline_config,mock_telemetry
['runner', 'result']
None
{"Assign": 3, "Expr": 2, "With": 1}
6
23
6
["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_fleet_list) defined within the public class called public.The function start at line 53 and ends at 75. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [53.0] and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_list_client_error
def test_cli_fleet_list_client_error(fresh_deadline_config):config.set_setting("defaults.farm_id", MOCK_FARM_ID)with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").list_fleets.side_effect = ClientError({"Error": {"Message": "A botocore client error"}}, "client error")runner = CliRunner()result = runner.invoke(main, ["fleet", "list"])assert "Failed to get Fleets" in result.outputassert "A botocore client error" in result.outputassert result.exit_code != 0
1
11
1
91
2
78
91
78
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 1, "With": 1}
7
14
7
["config.set_setting", "patch.object", "client", "session_mock", "ClientError", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_fleet_list_client_error) defined within the public class called public.The function start at line 78 and ends at 91. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["config.set_setting", "patch.object", "client", "session_mock", "ClientError", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_get
def test_cli_fleet_get(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected fleet, given mock data."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_fleet.return_value = MOCK_FLEETS_LIST[0]runner = CliRunner()result = runner.invoke(main, ["fleet", "get", "--fleet-id", MOCK_FLEET_ID])assert (result.output== """fleetId: fleet-0123456789abcdef0123456789abcdeffarmId: farm-0123456789abcdefabcdefabcdefabcddescription: The best fleet.displayName: MadFleetstatus: ACTIVEplatform: EC2_SPOTworkerRequirements:vCpus:min: 2max: 4memInGiB:min: 8max: 16autoScalerCapacities:min: 0max: 10createdAt: 2022-11-22 06:37:36+00:00createdBy: arn:aws:sts::123456789012:assumed-role/Admin""")session_mock().client("deadline").get_fleet.assert_called_once_with(farmId=MOCK_FARM_ID, fleetId=MOCK_FLEET_ID)assert result.exit_code == 0
1
13
1
103
2
94
132
94
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 3, "With": 1}
9
39
9
["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_fleet.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_fleet_get) defined within the public class called public.The function start at line 94 and ends at 132. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_fleet.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_get_with_queue_id
def test_cli_fleet_get_with_queue_id(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected fleets, given mock dataand a queue id parameter."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_queue.return_value = MOCK_QUEUES_LIST[0]session_mock().client("deadline").get_fleet.side_effect = deepcopy(MOCK_FLEETS_LIST)session_mock().client("deadline").list_queue_fleet_associations.return_value = {"queueFleetAssociations": [{"queueId": MOCK_QUEUES_LIST[0]["queueId"],"fleetId": MOCK_FLEETS_LIST[0]["fleetId"],"status": "ACTIVE",},{"queueId": MOCK_QUEUES_LIST[0]["queueId"],"fleetId": MOCK_FLEETS_LIST[1]["fleetId"],"status": "ACTIVE",},]}runner = CliRunner()result = runner.invoke(main, ["fleet", "get"])assert (result.output== """Showing all fleets (2 total) associated with queue: Testing QueuefleetId: fleet-0123456789abcdef0123456789abcdeffarmId: farm-0123456789abcdefabcdefabcdefabcddescription: The best fleet.displayName: MadFleetstatus: ACTIVEplatform: EC2_SPOTworkerRequirements:vCpus:min: 2max: 4memInGiB:min: 8max: 16autoScalerCapacities:min: 0max: 10createdAt: 2022-11-22 06:37:36+00:00createdBy: arn:aws:sts::123456789012:assumed-role/AdminqueueFleetAssociationStatus: ACTIVEfleetId: fleet-0223456789abcdef0223456789abcdeffarmId: farm-0123456789abcdefabcdefabcdefabcddescription: The maddest fleet.displayName: MadderFleetstatus: ACTIVEplatform: EC2_SPOTworkerRequirements:vCpus:min: 2max: 4memInGiB:min: 8max: 16autoScalerCapacities:min: 0max: 50createdAt: 2022-11-22 06:37:36+00:00createdBy: arn:aws:sts::123456789012:assumed-role/AdminqueueFleetAssociationStatus: ACTIVE""")assert result.exit_code == 0
1
26
1
176
2
135
211
135
fresh_deadline_config
['runner', 'result']
None
{"Assign": 5, "Expr": 3, "With": 1}
12
77
12
["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "client", "session_mock", "deepcopy", "client", "session_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_fleet_get_with_queue_id) defined within the public class called public.The function start at line 135 and ends at 211. It contains 26 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 12.0 functions, and It has 12.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "client", "session_mock", "deepcopy", "client", "session_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_get_override_profile
def test_cli_fleet_get_override_profile(fresh_deadline_config):"""Confirms that the --profile option overrides the option to boto3.Session."""# set the farm id for the overridden profileconfig.set_setting("defaults.aws_profile_name", "NonDefaultProfileName")config.set_setting("defaults.farm_id", "farm-overriddenid")config.set_setting("defaults.aws_profile_name", "DifferentProfileName")with patch.object(boto3, "Session") as session_mock:session_mock().client("deadline").get_fleet.return_value = MOCK_FLEETS_LIST[0]session_mock.reset_mock()runner = CliRunner()result = runner.invoke(main,["fleet", "get", "--profile", "NonDefaultProfileName", "--fleet-id", MOCK_FLEET_ID],)session_mock.assert_called_once_with(profile_name="NonDefaultProfileName")session_mock().client().get_fleet.assert_called_once_with(farmId="farm-overriddenid", fleetId=MOCK_FLEET_ID)assert result.exit_code == 0
1
17
1
126
2
214
237
214
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 7, "With": 1}
13
24
13
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_once_with", "get_fleet.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_fleet_get_override_profile) defined within the public class called public.The function start at line 214 and ends at 237. It contains 17 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 13.0 functions, and It has 13.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_once_with", "get_fleet.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_get_both_fleet_id_and_queue_id_provided
def test_cli_fleet_get_both_fleet_id_and_queue_id_provided(fresh_deadline_config):"""Confirm that the CLI interface fails when both fleet and queue id are provided"""config.set_setting("defaults.farm_id", "farm-overriddenid")with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_fleet.return_value = MOCK_FLEETS_LIST[0]runner = CliRunner()result = runner.invoke(main, ["fleet", "get", "--fleet-id", "fleetid", "--queue-id", "queueid"])assert "Only one of the --fleet-id and --queue-id options may be provided." in result.outputassert result.exit_code != 0
1
10
1
84
2
240
255
240
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 2, "With": 1}
6
16
6
["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_fleet_get_both_fleet_id_and_queue_id_provided) defined within the public class called public.The function start at line 240 and ends at 255. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_get_no_fleet_id_provided
def test_cli_fleet_get_no_fleet_id_provided(fresh_deadline_config):"""Confirm that the CLI interface fails when no fleet id is provided"""config.set_setting("defaults.farm_id", "farm-overriddenid")with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_fleet.return_value = MOCK_FLEETS_LIST[0]runner = CliRunner()result = runner.invoke(main, ["fleet", "get"])assert ("Missing '--fleet-id', '--queue-id', or default Queue ID configuration" in result.output)assert result.exit_code != 0
1
10
1
78
2
258
273
258
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 2, "With": 1}
6
16
6
["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_fleet_get_no_fleet_id_provided) defined within the public class called public.The function start at line 258 and ends at 273. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["config.set_setting", "patch.object", "client", "session_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_fleet_get_explicit_farm_id
def test_cli_fleet_get_explicit_farm_id(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected fleet, given mock data."""with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_fleet.return_value = MOCK_FLEETS_LIST[0]runner = CliRunner()result = runner.invoke(main,["fleet", "get", "--farm-id", MOCK_FARM_ID, "--fleet-id", MOCK_FLEET_ID],)assert (result.output== """fleetId: fleet-0123456789abcdef0123456789abcdeffarmId: farm-0123456789abcdefabcdefabcdefabcddescription: The best fleet.displayName: MadFleetstatus: ACTIVEplatform: EC2_SPOTworkerRequirements:vCpus:min: 2max: 4memInGiB:min: 8max: 16autoScalerCapacities:min: 0max: 10createdAt: 2022-11-22 06:37:36+00:00createdBy: arn:aws:sts::123456789012:assumed-role/Admin""")session_mock().client("deadline").get_fleet.assert_called_once_with(farmId=MOCK_FARM_ID, fleetId=MOCK_FLEET_ID)assert result.exit_code == 0
1
15
1
100
2
276
316
276
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 2, "With": 1}
8
41
8
["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_fleet.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_fleet_get_explicit_farm_id) defined within the public class called public.The function start at line 276 and ends at 316. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "get_fleet.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_parse_query_string
def test_parse_query_string():"""A few successful test cases."""assert parse_query_string("ab-c=def&x=73&xyz=testing-value", ["ab-c", "x", "xyz"], []) == {"ab_c": "def","x": "73","xyz": "testing-value",}assert parse_query_string("a=b&c=d", ["a", "c", "f", "g"], ["a", "c"]) == {"a": "b","c": "d",}
1
10
0
68
0
47
59
47
[]
None
{"Expr": 1}
2
13
2
["parse_query_string", "parse_query_string"]
0
[]
The function (test_parse_query_string) defined within the public class called public.The function start at line 47 and ends at 59. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["parse_query_string", "parse_query_string"].
aws-deadline_deadline-cloud
public
public
0
0
test_parse_query_string_missing_required
def test_parse_query_string_missing_required():"""Tests with missing required parameters"""with pytest.raises(DeadlineOperationError) as excinfo:parse_query_string("a-1=b&c=d", ["a-1", "c", "missing-required", "g"], ["a-1", "c", "missing-required"])assert "did not contain the required parameter" in str(excinfo)assert "missing-required" in str(excinfo)# The error message lists all the missing parameterswith pytest.raises(DeadlineOperationError) as excinfo:parse_query_string("a=b&c=d",["a", "c", "missing-required", "also-not-here", "not-required"],["a", "c", "missing-required", "also-not-here"],)assert "did not contain the required parameter" in str(excinfo)assert "missing-required" in str(excinfo)assert "also-not-here" in str(excinfo)assert "not-required" not in str(excinfo)
1
17
0
117
0
62
83
62
[]
None
{"Expr": 3, "With": 2}
10
22
10
["pytest.raises", "parse_query_string", "str", "str", "pytest.raises", "parse_query_string", "str", "str", "str", "str"]
0
[]
The function (test_parse_query_string_missing_required) defined within the public class called public.The function start at line 62 and ends at 83. It contains 17 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["pytest.raises", "parse_query_string", "str", "str", "pytest.raises", "parse_query_string", "str", "str", "str", "str"].
aws-deadline_deadline-cloud
public
public
0
0
test_parse_query_string_extra_parameters
def test_parse_query_string_extra_parameters():"""Tests with parameters that are not supposed to be there"""with pytest.raises(DeadlineOperationError) as excinfo:parse_query_string("a=b&c=d&extra-parameter=3", ["a", "c"], ["a"])assert "contained unsupported parameter" in str(excinfo)assert "extra-parameter" in str(excinfo)# The error message lists all the extra parameterswith pytest.raises(DeadlineOperationError) as excinfo:parse_query_string("a=b&c=d&extra-parameter=3&more-too-much=100&acceptable-one=xyz",["a", "c", "acceptable-one"],["a"],)assert "contained unsupported parameter" in str(excinfo)assert "extra-parameter" in str(excinfo)assert "more-too-much" in str(excinfo)assert "acceptable-one" not in str(excinfo)
1
15
0
99
0
86
105
86
[]
None
{"Expr": 3, "With": 2}
10
20
10
["pytest.raises", "parse_query_string", "str", "str", "pytest.raises", "parse_query_string", "str", "str", "str", "str"]
0
[]
The function (test_parse_query_string_extra_parameters) defined within the public class called public.The function start at line 86 and ends at 105. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["pytest.raises", "parse_query_string", "str", "str", "pytest.raises", "parse_query_string", "str", "str", "str", "str"].
aws-deadline_deadline-cloud
public
public
0
0
test_parse_query_string_duplicate_parameters
def test_parse_query_string_duplicate_parameters():"""Tests with a repeated parameter"""with pytest.raises(DeadlineOperationError) as excinfo:parse_query_string("duplicated-param=b&c=d&duplicated-param=e", ["duplicated-param", "c"], ["c"])assert "provided multiple times" in str(excinfo)assert "duplicated-param" in str(excinfo)
1
7
0
43
0
108
117
108
[]
None
{"Expr": 2, "With": 1}
4
10
4
["pytest.raises", "parse_query_string", "str", "str"]
0
[]
The function (test_parse_query_string_duplicate_parameters) defined within the public class called public.The function start at line 108 and ends at 117. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 functions called inside which are ["pytest.raises", "parse_query_string", "str", "str"].
aws-deadline_deadline-cloud
public
public
0
0
test_validate_resource_ids_successful
def test_validate_resource_ids_successful(ids: Dict[str, str]):"""A few successful test cases."""validate_resource_ids(ids)
1
2
1
17
0
144
148
144
ids
[]
None
{"Expr": 2}
2
5
2
["validate_resource_ids", "pytest.mark.parametrize"]
0
[]
The function (test_validate_resource_ids_successful) defined within the public class called public.The function start at line 144 and ends at 148. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["validate_resource_ids", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_validate_resource_ids_failed
def test_validate_resource_ids_failed(ids: Dict[str, str], exception_message: str):"""Tests with invalid IDs."""with pytest.raises(DeadlineOperationError) as excinfo:validate_resource_ids(ids)assert exception_message in str(excinfo)
1
4
2
38
0
205
211
205
ids,exception_message
[]
None
{"Expr": 2, "With": 1}
4
7
4
["pytest.raises", "validate_resource_ids", "str", "pytest.mark.parametrize"]
0
[]
The function (test_validate_resource_ids_failed) defined within the public class called public.The function start at line 205 and ends at 211. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [205.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions called inside which are ["pytest.raises", "validate_resource_ids", "str", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_validate_id_format_successful
def test_validate_id_format_successful(resource_type: str, full_id_str: str):"""A few successful test cases."""assert validate_id_format(resource_type, full_id_str)
1
2
2
19
0
224
228
224
resource_type,full_id_str
[]
None
{"Expr": 1}
2
5
2
["validate_id_format", "pytest.mark.parametrize"]
0
[]
The function (test_validate_id_format_successful) defined within the public class called public.The function start at line 224 and ends at 228. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [224.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["validate_id_format", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_validate_id_format_failed
def test_validate_id_format_failed(resource_type: str, full_id_str: str):"""Tests with invalid IDs."""assert not validate_id_format(resource_type, full_id_str)
1
2
2
20
0
251
255
251
resource_type,full_id_str
[]
None
{"Expr": 1}
2
5
2
["validate_id_format", "pytest.mark.parametrize"]
0
[]
The function (test_validate_id_format_failed) defined within the public class called public.The function start at line 251 and ends at 255. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [251.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["validate_id_format", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_download_output_only_required_input
def test_cli_handle_web_url_download_output_only_required_input(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected list offarms, given mock data."""set_setting("settings.auto_accept", "true")with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadmock_host_path_format_name = PathFormat.get_host_path_format_string()boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": "/root/path","rootPathFormat": PathFormat(mock_host_path_format_name),"outputRelativeDirectories": ["."],}],},}boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]web_url = f"deadline://download-output?farm-id={MOCK_FARM_ID}&queue-id={MOCK_QUEUE_ID}&job-id={MOCK_JOB_ID}"runner = CliRunner()result = runner.invoke(main, ["handle-web-url", web_url])MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=None,task_id=None,session=ANY,)mock_download.assert_called_once_with(file_conflict_resolution=FileConflictResolution.CREATE_COPY,on_downloading_files=ANY,)assert result.exit_code == 0, result.output
1
43
1
224
5
258
309
258
fresh_deadline_config
['mock_download', 'mock_host_path_format_name', 'web_url', 'runner', 'result']
None
{"Assign": 9, "Expr": 4, "With": 1}
15
52
15
["set_setting", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_download.assert_called_once_with"]
0
[]
The function (test_cli_handle_web_url_download_output_only_required_input) defined within the public class called public.The function start at line 258 and ends at 309. It contains 43 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 15.0 functions, and It has 15.0 functions called inside which are ["set_setting", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_download.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_download_output_with_optional_input
def test_cli_handle_web_url_download_output_with_optional_input(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected list offarms, given mock data."""set_setting("settings.auto_accept", "true")with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "round", return_value=0), patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadmock_host_path_format_name = PathFormat.get_host_path_format_string()boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": "/root/path","rootPathFormat": PathFormat(mock_host_path_format_name),"outputRelativeDirectories": ["."],}],},}boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]web_url = (f"deadline://download-output?farm-id={MOCK_FARM_ID}&queue-id={MOCK_QUEUE_ID}&job-id={MOCK_JOB_ID}"+ f"&step-id={MOCK_STEP_ID}&task-id={MOCK_TASK_ID}&profile={MOCK_PROFILE_NAME}")runner = CliRunner()result = runner.invoke(main, ["handle-web-url", web_url])assert result.exit_code == 0, result.outputMockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=MOCK_STEP_ID,task_id=MOCK_TASK_ID,session=ANY,)mock_download.assert_called_once_with(file_conflict_resolution=FileConflictResolution.CREATE_COPY,on_downloading_files=ANY,)
1
48
1
242
5
312
368
312
fresh_deadline_config
['mock_download', 'mock_host_path_format_name', 'web_url', 'runner', 'result']
None
{"Assign": 9, "Expr": 4, "With": 1}
16
57
16
["set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_download.assert_called_once_with"]
0
[]
The function (test_cli_handle_web_url_download_output_with_optional_input) defined within the public class called public.The function start at line 312 and ends at 368. It contains 48 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 16.0 functions, and It has 16.0 functions called inside which are ["set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_download.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_unsupported_protocol_scheme
def test_cli_handle_web_url_unsupported_protocol_scheme(fresh_deadline_config):"""Tests that an error is returned when an unsupported url is passed to the handle-web-url command"""runner = CliRunner()result = runner.invoke(main, ["handle-web-url", "https://sketchy-website.com"])assert "URL scheme https is not supported." in result.outputassert result.exit_code != 0
1
5
1
37
2
371
379
371
fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
2
9
2
["CliRunner", "runner.invoke"]
0
[]
The function (test_cli_handle_web_url_unsupported_protocol_scheme) defined within the public class called public.The function start at line 371 and ends at 379. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_command_not_allowlisted
def test_cli_handle_web_url_command_not_allowlisted(fresh_deadline_config):"""Tests that a command that isn't explicitly allowlisted isn't ran."""runner = CliRunner()result = runner.invoke(main, ["handle-web-url", "deadline://config"])assert "Command config is not supported through handle-web-url." in result.outputassert result.exit_code != 0
1
5
1
37
2
382
390
382
fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
2
9
2
["CliRunner", "runner.invoke"]
0
[]
The function (test_cli_handle_web_url_command_not_allowlisted) defined within the public class called public.The function start at line 382 and ends at 390. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_handle_web_url_command_not_allowlisted_with_prompt
def test_handle_web_url_command_not_allowlisted_with_prompt(fresh_deadline_config):"""Tests that a command that isn't explicitly allowlisted isn't ran. Test with a prompt for the exit."""runner = CliRunner()result = runner.invoke(main,["handle-web-url", "deadline://config", "--prompt-when-complete"],input="\n",)assert "Command config is not supported through handle-web-url." in result.outputassert result.exit_code != 0
1
9
1
44
2
393
405
393
fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
2
13
2
["CliRunner", "runner.invoke"]
0
[]
The function (test_handle_web_url_command_not_allowlisted_with_prompt) defined within the public class called public.The function start at line 393 and ends at 405. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_handle_web_url_missing_required_args
def test_handle_web_url_missing_required_args(fresh_deadline_config, url: str, missing_names: List[str]):"""Tests an error is returned when a required argument is missing."""runner = CliRunner()result = runner.invoke(main,["handle-web-url",url,],)assert "The URL query did not contain the required parameter(s)" in result.outputfor name in missing_names:assert name in result.outputassert result.exit_code != 0
2
15
3
61
2
418
436
418
fresh_deadline_config,url,missing_names
['runner', 'result']
None
{"Assign": 2, "Expr": 1, "For": 1}
3
19
3
["CliRunner", "runner.invoke", "pytest.mark.parametrize"]
0
[]
The function (test_handle_web_url_missing_required_args) defined within the public class called public.The function start at line 418 and ends at 436. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [418.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["CliRunner", "runner.invoke", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_handle_web_url_incorrect_install_option
def test_handle_web_url_incorrect_install_option(fresh_deadline_config, install_option):"""Tests that the install/uninstall commands cannot be used with a URL"""runner = CliRunner()result = runner.invoke(main,["handle-web-url", "deadline://config", install_option],)assert ("The --install, --uninstall and --all-users options cannot be used with a provided URL."in result.output)assert result.exit_code != 0
1
11
2
44
2
440
454
440
fresh_deadline_config,install_option
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
3
15
3
["CliRunner", "runner.invoke", "pytest.mark.parametrize"]
0
[]
The function (test_handle_web_url_incorrect_install_option) defined within the public class called public.The function start at line 440 and ends at 454. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [440.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["CliRunner", "runner.invoke", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_handle_web_url_both_install_and_uninstall
def test_handle_web_url_both_install_and_uninstall(fresh_deadline_config):"""Tests that install & uninstall cannot be used together"""runner = CliRunner()result = runner.invoke(main,["handle-web-url", "--install", "--uninstall"],)assert "Only one of the --install and --uninstall options may be provided." in result.outputassert result.exit_code != 0
1
8
1
40
2
457
468
457
fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
2
12
2
["CliRunner", "runner.invoke"]
0
[]
The function (test_handle_web_url_both_install_and_uninstall) defined within the public class called public.The function start at line 457 and ends at 468. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_handle_web_url_require_url_or_install_option
def test_handle_web_url_require_url_or_install_option(fresh_deadline_config):"""Tests that install & uninstall cannot be used together"""runner = CliRunner()result = runner.invoke(main,["handle-web-url"],)assert "At least one of a URL, --install, or --uninstall must be provided." in result.outputassert result.exit_code != 0
1
8
1
36
2
471
482
471
fresh_deadline_config
['runner', 'result']
None
{"Assign": 2, "Expr": 1}
2
12
2
["CliRunner", "runner.invoke"]
0
[]
The function (test_handle_web_url_require_url_or_install_option) defined within the public class called public.The function start at line 471 and ends at 482. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_install
def test_cli_handle_web_url_install(fresh_deadline_config, install_command, all_users):"""Confirm that the install command calls the implementation function"""with patch.object(handle_web_url_command, f"{install_command}_deadline_web_url_handler") as mock_install:runner = CliRunner()cli_options = ["handle-web-url", f"--{install_command}"]if all_users:cli_options.append("--all-users")result = runner.invoke(main, cli_options)mock_install.assert_called_once_with(all_users=all_users)assert result.exit_code == 0
2
11
3
69
3
487
501
487
fresh_deadline_config,install_command,all_users
['result', 'runner', 'cli_options']
None
{"Assign": 3, "Expr": 3, "If": 1, "With": 1}
7
15
7
["patch.object", "CliRunner", "cli_options.append", "runner.invoke", "mock_install.assert_called_once_with", "pytest.mark.parametrize", "pytest.mark.parametrize"]
0
[]
The function (test_cli_handle_web_url_install) defined within the public class called public.The function start at line 487 and ends at 501. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [487.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["patch.object", "CliRunner", "cli_options.append", "runner.invoke", "mock_install.assert_called_once_with", "pytest.mark.parametrize", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_install_current_user_monkeypatched_windows
def test_cli_handle_web_url_install_current_user_monkeypatched_windows(fresh_deadline_config, monkeypatch):"""Tests the registry installation calls for Windows URL handler installers.By monkeypatching, we can test this on any OS.This test is pretty inflexible, it verifies that the specific set of known-good winregcalls are made."""winreg_mock = MagicMock()monkeypatch.setitem(sys.modules, "winreg", winreg_mock)with patch.object(sys, "platform", "win32"), patch.object(os.path, "isfile") as isfile_mock:# Tell the handler that everything is a file, so it succeeds when it checks on argv[0]isfile_mock.return_value = Truewinreg_mock.HKEY_CURRENT_USER = "HKEY_CURRENT_USER"winreg_mock.HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT"winreg_mock.REG_SZ = "REG_SZ"winreg_mock.OpenKeyEx.side_effect = ["FIRST_OPENED_KEY", "SECOND_OPENED_KEY"]winreg_mock.CreateKeyEx.side_effect = ["FIRST_CREATED_KEY", "SECOND_CREATED_KEY"]runner = CliRunner()result = runner.invoke(main, ["handle-web-url", "--install"])winreg_mock.assert_has_calls([call.CreateKeyEx("HKEY_CURRENT_USER", "Software\\Classes\\deadline"),call.SetValueEx("FIRST_CREATED_KEY", None, 0, "REG_SZ", "URL:AWS Deadline Cloud Protocol"),call.SetValueEx("FIRST_CREATED_KEY", "URL Protocol", 0, "REG_SZ", ""),call.CreateKeyEx("FIRST_CREATED_KEY", "shell\\open\\command"),call.SetValueEx("SECOND_CREATED_KEY",None,0,"REG_SZ",ANY,),call.CloseKey("SECOND_CREATED_KEY"),call.CloseKey("FIRST_CREATED_KEY"),])assert result.output.strip() == ""
1
34
2
206
3
504
549
504
fresh_deadline_config,monkeypatch
['runner', 'result', 'winreg_mock']
None
{"Assign": 9, "Expr": 3, "With": 1}
15
46
15
["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.CreateKeyEx", "call.SetValueEx", "call.SetValueEx", "call.CreateKeyEx", "call.SetValueEx", "call.CloseKey", "call.CloseKey", "result.output.strip"]
0
[]
The function (test_cli_handle_web_url_install_current_user_monkeypatched_windows) defined within the public class called public.The function start at line 504 and ends at 549. It contains 34 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [504.0] and does not return any value. It declares 15.0 functions, and It has 15.0 functions called inside which are ["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.CreateKeyEx", "call.SetValueEx", "call.SetValueEx", "call.CreateKeyEx", "call.SetValueEx", "call.CloseKey", "call.CloseKey", "result.output.strip"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_install_all_users_monkeypatched_windows
def test_cli_handle_web_url_install_all_users_monkeypatched_windows(fresh_deadline_config, monkeypatch):"""Tests the registry installation calls for Windows URL handler installers.By monkeypatching, we can test this on any OS.This test is pretty inflexible, it verifies that the specific set of known-good winregcalls are made."""winreg_mock = MagicMock()monkeypatch.setitem(sys.modules, "winreg", winreg_mock)with patch.object(sys, "platform", "win32"), patch.object(os.path, "isfile") as isfile_mock:# Tell the handler that everything is a file, so it succeeds when it checks on argv[0]isfile_mock.return_value = Truewinreg_mock.HKEY_CURRENT_USER = "HKEY_CURRENT_USER"winreg_mock.HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT"winreg_mock.REG_SZ = "REG_SZ"winreg_mock.OpenKeyEx.side_effect = ["FIRST_OPENED_KEY", "SECOND_OPENED_KEY"]winreg_mock.CreateKeyEx.side_effect = ["FIRST_CREATED_KEY", "SECOND_CREATED_KEY"]runner = CliRunner()result = runner.invoke(main, ["handle-web-url", "--install", "--all-users"])winreg_mock.assert_has_calls([call.CreateKeyEx("HKEY_CLASSES_ROOT", "deadline"),call.SetValueEx("FIRST_CREATED_KEY", None, 0, "REG_SZ", "URL:AWS Deadline Cloud Protocol"),call.SetValueEx("FIRST_CREATED_KEY", "URL Protocol", 0, "REG_SZ", ""),call.CreateKeyEx("FIRST_CREATED_KEY", "shell\\open\\command"),call.SetValueEx("SECOND_CREATED_KEY",None,0,"REG_SZ",ANY,),call.CloseKey("SECOND_CREATED_KEY"),call.CloseKey("FIRST_CREATED_KEY"),])assert result.output.strip() == ""
1
34
2
208
3
552
597
552
fresh_deadline_config,monkeypatch
['runner', 'result', 'winreg_mock']
None
{"Assign": 9, "Expr": 3, "With": 1}
15
46
15
["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.CreateKeyEx", "call.SetValueEx", "call.SetValueEx", "call.CreateKeyEx", "call.SetValueEx", "call.CloseKey", "call.CloseKey", "result.output.strip"]
0
[]
The function (test_cli_handle_web_url_install_all_users_monkeypatched_windows) defined within the public class called public.The function start at line 552 and ends at 597. It contains 34 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [552.0] and does not return any value. It declares 15.0 functions, and It has 15.0 functions called inside which are ["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.CreateKeyEx", "call.SetValueEx", "call.SetValueEx", "call.CreateKeyEx", "call.SetValueEx", "call.CloseKey", "call.CloseKey", "result.output.strip"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_uninstall_current_user_monkeypatched_windows
def test_cli_handle_web_url_uninstall_current_user_monkeypatched_windows(fresh_deadline_config, monkeypatch):"""Tests the registry installation calls for Windows URL handler installers.By monkeypatching, we can test this on any OS.This test is pretty inflexible, it verifies that the specific set of known-good winregcalls are made."""winreg_mock = MagicMock()monkeypatch.setitem(sys.modules, "winreg", winreg_mock)with patch.object(sys, "platform", "win32"), patch.object(os.path, "isfile") as isfile_mock:# Tell the handler that everything is a file, so it succeeds when it checks on argv[0]isfile_mock.return_value = Truewinreg_mock.HKEY_CURRENT_USER = "HKEY_CURRENT_USER"winreg_mock.HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT"winreg_mock.REG_SZ = "REG_SZ"winreg_mock.OpenKeyEx.side_effect = ["FIRST_OPENED_KEY", "SECOND_OPENED_KEY"]winreg_mock.CreateKeyEx.side_effect = ["FIRST_CREATED_KEY", "SECOND_CREATED_KEY"]runner = CliRunner()result = runner.invoke(main, ["handle-web-url", "--uninstall"])winreg_mock.assert_has_calls([call.OpenKeyEx("HKEY_CURRENT_USER", "Software\\Classes"),call.DeleteKeyEx("FIRST_OPENED_KEY", "deadline\\shell\\open\\command"),call.DeleteKeyEx("FIRST_OPENED_KEY", "deadline\\shell\\open"),call.DeleteKeyEx("FIRST_OPENED_KEY", "deadline\\shell"),call.DeleteKeyEx("FIRST_OPENED_KEY", "deadline"),call.CloseKey("FIRST_OPENED_KEY"),])assert result.output.strip() == ""
1
25
2
180
3
600
636
600
fresh_deadline_config,monkeypatch
['runner', 'result', 'winreg_mock']
None
{"Assign": 9, "Expr": 3, "With": 1}
14
37
14
["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.OpenKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.CloseKey", "result.output.strip"]
0
[]
The function (test_cli_handle_web_url_uninstall_current_user_monkeypatched_windows) defined within the public class called public.The function start at line 600 and ends at 636. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [600.0] and does not return any value. It declares 14.0 functions, and It has 14.0 functions called inside which are ["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.OpenKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.CloseKey", "result.output.strip"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_handle_web_url_uninstall_all_users_monkeypatched_windows
def test_cli_handle_web_url_uninstall_all_users_monkeypatched_windows(fresh_deadline_config, monkeypatch):"""Tests the registry installation calls for Windows URL handler installers.By monkeypatching, we can test this on any OS.This test is pretty inflexible, it verifies that the specific set of known-good winregcalls are made."""winreg_mock = MagicMock()monkeypatch.setitem(sys.modules, "winreg", winreg_mock)with patch.object(sys, "platform", "win32"), patch.object(os.path, "isfile") as isfile_mock:# Tell the handler that everything is a file, so it succeeds when it checks on argv[0]isfile_mock.return_value = Truewinreg_mock.HKEY_CURRENT_USER = "HKEY_CURRENT_USER"winreg_mock.HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT"winreg_mock.REG_SZ = "REG_SZ"winreg_mock.OpenKeyEx.side_effect = ["FIRST_OPENED_KEY", "SECOND_OPENED_KEY"]winreg_mock.CreateKeyEx.side_effect = ["FIRST_CREATED_KEY", "SECOND_CREATED_KEY"]runner = CliRunner()result = runner.invoke(main, ["handle-web-url", "--uninstall", "--all-users"])winreg_mock.assert_has_calls([call.DeleteKeyEx("HKEY_CLASSES_ROOT", "deadline\\shell\\open\\command"),call.DeleteKeyEx("HKEY_CLASSES_ROOT", "deadline\\shell\\open"),call.DeleteKeyEx("HKEY_CLASSES_ROOT", "deadline\\shell"),call.DeleteKeyEx("HKEY_CLASSES_ROOT", "deadline"),])assert result.output.strip() == ""
1
23
2
166
3
639
673
639
fresh_deadline_config,monkeypatch
['runner', 'result', 'winreg_mock']
None
{"Assign": 9, "Expr": 3, "With": 1}
12
35
12
["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "result.output.strip"]
0
[]
The function (test_cli_handle_web_url_uninstall_all_users_monkeypatched_windows) defined within the public class called public.The function start at line 639 and ends at 673. It contains 23 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [639.0] and does not return any value. It declares 12.0 functions, and It has 12.0 functions called inside which are ["MagicMock", "monkeypatch.setitem", "patch.object", "patch.object", "CliRunner", "runner.invoke", "winreg_mock.assert_has_calls", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "call.DeleteKeyEx", "result.output.strip"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_list
def test_cli_job_list(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected list ofjobs, given mock data."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").search_jobs.return_value = {"jobs": MOCK_JOBS_LIST,"totalResults": 12,"itemOffset": len(MOCK_JOBS_LIST),}runner = CliRunner()result = runner.invoke(main, ["job", "list"])assert (result.output== """Displaying 2 of 12 Jobs starting at 0- name: CLI JobjobId: job-aaf4cdf8aae242f58fb84c5bb19f199btaskRunStatus: RUNNINGstartedAt: 2023-01-27 07:37:53+00:00endedAt: 2023-01-27 07:39:17+00:00createdBy: b801f3c0-c071-70bc-b869-6804bc732408createdAt: 2023-01-27 07:34:41+00:00- name: CLI JobjobId: job-0d239749fa05435f90263b3a8be54144taskRunStatus: COMPLETEDstartedAt: 2023-01-27 07:27:06+00:00endedAt: 2023-01-27 07:29:51+00:00createdBy: b801f3c0-c071-70bc-b869-6804bc732408createdAt: 2023-01-27 07:24:22+00:00""")assert result.exit_code == 0
1
15
1
99
2
140
179
140
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 3, "With": 1}
8
40
8
["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_list) defined within the public class called public.The function start at line 140 and ends at 179. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_list_explicit_farm_and_queue_id
def test_cli_job_list_explicit_farm_and_queue_id(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected list ofjobs, given mock data."""with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").search_jobs.return_value = {"jobs": MOCK_JOBS_LIST,"totalResults": 12,"itemOffset": len(MOCK_JOBS_LIST),}runner = CliRunner()result = runner.invoke(main,["job", "list", "--farm-id", MOCK_FARM_ID, "--queue-id", MOCK_QUEUE_ID],)assert (result.output== """Displaying 2 of 12 Jobs starting at 0- name: CLI JobjobId: job-aaf4cdf8aae242f58fb84c5bb19f199btaskRunStatus: RUNNINGstartedAt: 2023-01-27 07:37:53+00:00endedAt: 2023-01-27 07:39:17+00:00createdBy: b801f3c0-c071-70bc-b869-6804bc732408createdAt: 2023-01-27 07:34:41+00:00- name: CLI JobjobId: job-0d239749fa05435f90263b3a8be54144taskRunStatus: COMPLETEDstartedAt: 2023-01-27 07:27:06+00:00endedAt: 2023-01-27 07:29:51+00:00createdBy: b801f3c0-c071-70bc-b869-6804bc732408createdAt: 2023-01-27 07:24:22+00:00""")assert result.exit_code == 0
1
16
1
92
2
182
221
182
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 1, "With": 1}
6
40
6
["patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_list_explicit_farm_and_queue_id) defined within the public class called public.The function start at line 182 and ends at 221. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_list_override_profile
def test_cli_job_list_override_profile(fresh_deadline_config):"""Confirms that the --profile option overrides the option to boto3.Session."""# set the farm id for the overridden profileconfig.set_setting("defaults.aws_profile_name", "NonDefaultProfileName")config.set_setting("defaults.farm_id", "farm-overriddenid")config.set_setting("defaults.queue_id", "queue-overriddenid")config.set_setting("defaults.aws_profile_name", "DifferentProfileName")with patch.object(boto3, "Session") as session_mock:session_mock().client("deadline").search_jobs.return_value = {"jobs": MOCK_JOBS_LIST,"totalResults": 12,"nextPage": len(MOCK_JOBS_LIST),}session_mock.reset_mock()runner = CliRunner()result = runner.invoke(main, ["job", "list", "--profile", "NonDefaultProfileName"])assert result.exit_code == 0session_mock.assert_called_once_with(profile_name="NonDefaultProfileName")session_mock().client().search_jobs.assert_called_once_with(farmId="farm-overriddenid",queueIds=["queue-overriddenid"],itemOffset=0,pageSize=5,sortExpressions=[{"fieldSort": {"name": "CREATED_AT", "sortOrder": "DESCENDING"}}],)
1
23
1
171
2
224
253
224
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 8, "With": 1}
15
30
15
["config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "len", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_once_with", "search_jobs.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_job_list_override_profile) defined within the public class called public.The function start at line 224 and ends at 253. It contains 23 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 15.0 functions, and It has 15.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "len", "session_mock.reset_mock", "CliRunner", "runner.invoke", "session_mock.assert_called_once_with", "search_jobs.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_list_no_farm_id
def test_cli_job_list_no_farm_id(fresh_deadline_config):with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").search_jobs.return_value = {"jobs": MOCK_JOBS_LIST,"totalResults": 12,"nextPage": len(MOCK_JOBS_LIST),}runner = CliRunner()result = runner.invoke(main, ["job", "list"])assert "Missing '--farm-id' or default Farm ID configuration" in result.outputassert result.exit_code != 0
1
11
1
80
2
256
268
256
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "With": 1}
6
13
6
["patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_list_no_farm_id) defined within the public class called public.The function start at line 256 and ends at 268. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_list_no_queue_id
def test_cli_job_list_no_queue_id(fresh_deadline_config):config.set_setting("defaults.farm_id", MOCK_FARM_ID)with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").search_jobs.return_value = {"jobs": MOCK_JOBS_LIST,"totalResults": 12,"nextPage": len(MOCK_JOBS_LIST),}runner = CliRunner()result = runner.invoke(main, ["job", "list"])assert "Missing '--queue-id' or default Queue ID configuration" in result.outputassert result.exit_code != 0
1
12
1
88
2
271
285
271
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 1, "With": 1}
7
15
7
["config.set_setting", "patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_list_no_queue_id) defined within the public class called public.The function start at line 271 and ends at 285. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["config.set_setting", "patch.object", "client", "session_mock", "len", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_list_client_error
def test_cli_job_list_client_error(fresh_deadline_config):config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").search_jobs.side_effect = ClientError({"Error": {"Message": "A botocore client error"}}, "client error")runner = CliRunner()result = runner.invoke(main, ["job", "list"])assert "Failed to get Jobs" in result.outputassert "A botocore client error" in result.outputassert result.exit_code != 0
1
12
1
99
2
288
302
288
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 2, "With": 1}
8
15
8
["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "ClientError", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_list_client_error) defined within the public class called public.The function start at line 288 and ends at 302. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "client", "session_mock", "ClientError", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_get
def test_cli_job_get(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected job, given mock data."""with patch.object(api._session, "get_boto3_session") as session_mock:session_mock().client("deadline").get_job.return_value = MOCK_JOBS_LIST[0]runner = CliRunner()result = runner.invoke(main,["job","get","--farm-id",MOCK_FARM_ID,"--queue-id",MOCK_QUEUE_ID,"--job-id",str(MOCK_JOBS_LIST[0]["jobId"]),],)assert (result.output== """jobId: job-aaf4cdf8aae242f58fb84c5bb19f199bname: CLI JobtaskRunStatus: RUNNINGlifecycleStatus: SUCCEEDEDcreatedBy: b801f3c0-c071-70bc-b869-6804bc732408createdAt: 2023-01-27 07:34:41+00:00startedAt: 2023-01-27 07:37:53+00:00endedAt: 2023-01-27 07:39:17+00:00priority: 50""")session_mock().client("deadline").get_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOBS_LIST[0]["jobId"])assert result.exit_code == 0
1
24
1
124
2
305
345
305
fresh_deadline_config
['runner', 'result']
None
{"Assign": 3, "Expr": 2, "With": 1}
9
41
9
["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "str", "get_job.assert_called_once_with", "client", "session_mock"]
0
[]
The function (test_cli_job_get) defined within the public class called public.The function start at line 305 and ends at 345. It contains 24 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "str", "get_job.assert_called_once_with", "client", "session_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_download_output_stdout_with_only_required_input
def test_cli_job_download_output_stdout_with_only_required_input(fresh_deadline_config, tmp_path: Path):"""Tests whether the output messages printed to stdout match expected messageswhen `download-output` command is executed."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "_get_conflicting_filenames", return_value=[]), patch.object(job_group, "round", return_value=0), patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadmock_root_path = "/root/path" if sys.platform != "win32" else "C:\\Users\\username"mock_files_list = ["outputs/file1.txt", "outputs/file2.txt", "outputs/file3.txt"]MockOutputDownloader.return_value.get_output_paths_by_root.side_effect = [{f"{mock_root_path}": mock_files_list,f"{mock_root_path}2": mock_files_list,},{f"{mock_root_path}": mock_files_list,f"{mock_root_path}2": mock_files_list,},{f"{mock_root_path}": mock_files_list,str(tmp_path): mock_files_list,},]mock_host_path_format = PathFormat.get_host_path_format()boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": f"{mock_root_path}","rootPathFormat": mock_host_path_format,"outputRelativeDirectories": ["."],},{"rootPath": f"{mock_root_path}2","rootPathFormat": mock_host_path_format,"outputRelativeDirectories": ["."],},],},}runner = CliRunner()result = runner.invoke(main,["job", "download-output", "--job-id", MOCK_JOB_ID, "--output", "verbose"],input=f"1\n{str(tmp_path)}\ny\n",)MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=None,task_id=None,session=ANY,)path_separator = "/" if sys.platform != "win32" else "\\"assert (f"""Downloading output from Job 'Mock Job'Summary of files to download:{mock_root_path}{path_separator}outputs (3 files){mock_root_path}2{path_separator}outputs (3 files)You are about to download files which may come from multiple root directories. Here are a list of the current root directories:[0] {mock_root_path}[1] {mock_root_path}2> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download (0, 1, y, n) [y]: 1> Please enter the new root directory path, or press Enter to keep it unchanged [{mock_root_path}2]: {str(tmp_path)}Summary of files to download:{mock_root_path}{path_separator}outputs (3 files){str(tmp_path)}{path_separator}outputs (3 files)You are about to download files which may come from multiple root directories. Here are a list of the current root directories:[0] {mock_root_path}[1] {str(tmp_path)}> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download (0, 1, y, n) [y]: y"""in result.output)assert "Download Summary:" in result.outputassert result.exit_code == 0
3
75
2
370
7
348
454
348
fresh_deadline_config,tmp_path
['mock_download', 'mock_files_list', 'mock_host_path_format', 'runner', 'mock_root_path', 'path_separator', 'result']
None
{"Assign": 12, "Expr": 4, "With": 1}
21
107
21
["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "PathFormat.get_host_path_format", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "str", "str", "str"]
0
[]
The function (test_cli_job_download_output_stdout_with_only_required_input) defined within the public class called public.The function start at line 348 and ends at 454. It contains 75 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [348.0] and does not return any value. It declares 21.0 functions, and It has 21.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "PathFormat.get_host_path_format", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "str", "str", "str"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_download_output_stdout_with_mismatching_path_format
def test_cli_job_download_output_stdout_with_mismatching_path_format(fresh_deadline_config, tmp_path: Path):"""Tests that the `download-output` command handles cross-platform situations,where the output files of the job submitted on Windows need to be downloadedon non-Windows and vice versa, by verifying that the output messages printedto stdout match expected messages."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "_get_conflicting_filenames", return_value=[]), patch.object(job_group, "round", return_value=0), patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadmock_root_path = "C:\\Users\\username" if sys.platform != "win32" else "/root/path"mock_files_list = ["outputs/file1.txt", "outputs/file2.txt", "outputs/file3.txt"]MockOutputDownloader.return_value.get_output_paths_by_root.side_effect = [{f"{mock_root_path}": mock_files_list,},{str(tmp_path): mock_files_list,},{str(tmp_path): mock_files_list,},]# Get the opposite path format of the current operating systemcurrent_format = PathFormat.get_host_path_format()other_format = (PathFormat.WINDOWS if current_format == PathFormat.POSIX else PathFormat.POSIX)boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": f"{mock_root_path}","rootPathFormat": other_format,"outputRelativeDirectories": ["."],},],},}runner = CliRunner()result = runner.invoke(main,["job", "download-output", "--job-id", MOCK_JOB_ID, "--output", "verbose"],input=f"{str(tmp_path)}\ny\n",)MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=None,task_id=None,session=ANY,)path_separator = "/" if sys.platform != "win32" else "\\"assert (f"""Downloading output from Job 'Mock Job'This root path format does not match the operating system you're using. Where would you like to save the files?The location was {mock_root_path}, on {other_format[0].upper() + other_format[1:]}.> Please enter a new root path: {str(tmp_path)}Summary of files to download:{str(tmp_path)}{path_separator}outputs (3 files)You are about to download files which may come from multiple root directories. Here are a list of the current root directories:[0] {str(tmp_path)}> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download (0, y, n) [y]: y"""in result.output)assert "Download Summary:" in result.outputassert result.exit_code == 0
4
70
2
356
8
457
553
457
fresh_deadline_config,tmp_path
['mock_download', 'other_format', 'mock_files_list', 'runner', 'mock_root_path', 'current_format', 'path_separator', 'result']
None
{"Assign": 13, "Expr": 4, "With": 1}
23
97
23
["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "str", "PathFormat.get_host_path_format", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "upper", "str", "str", "str"]
0
[]
The function (test_cli_job_download_output_stdout_with_mismatching_path_format) defined within the public class called public.The function start at line 457 and ends at 553. It contains 70 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [457.0] and does not return any value. It declares 23.0 functions, and It has 23.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "str", "PathFormat.get_host_path_format", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "upper", "str", "str", "str"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_download_output_handles_unc_path_on_windows
def test_cli_job_download_output_handles_unc_path_on_windows(fresh_deadline_config, tmp_path: Path):"""This tests only runs on Windows OS.Executes the `download-output` command on a job that has a root path of UNC format,and verifies that the output messages printed to stdout match expected messages."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "_get_conflicting_filenames", return_value=[]), patch.object(job_group, "round", return_value=0), patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_download# UNC format (which refers to the same location as 'C:\Users\username')mock_root_path = "\\\\127.0.0.1\\c$\\Users\\username"mock_files_list = ["outputs/file1.txt", "outputs/file2.txt", "outputs/file3.txt"]MockOutputDownloader.return_value.get_output_paths_by_root.side_effect = [{f"{mock_root_path}": mock_files_list,},{f"{mock_root_path}": mock_files_list,},{str(tmp_path): mock_files_list,},]boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": f"{mock_root_path}","rootPathFormat": PathFormat.WINDOWS,"outputRelativeDirectories": ["."],},],},}runner = CliRunner()result = runner.invoke(main,["job", "download-output", "--job-id", MOCK_JOB_ID, "--output", "verbose"],input=f"0\n{str(tmp_path)}\ny\n",)MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=None,task_id=None,session=ANY,)path_separator = "/" if sys.platform != "win32" else "\\"assert (f"""Downloading output from Job 'Mock Job'Summary of files to download:{mock_root_path}{path_separator}outputs (3 files)You are about to download files which may come from multiple root directories. Here are a list of the current root directories:[0] {mock_root_path}> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download (0, y, n) [y]: 0> Please enter the new root directory path, or press Enter to keep it unchanged [{mock_root_path}]: {str(tmp_path)}Summary of files to download:{str(tmp_path)}{path_separator}outputs (3 files)You are about to download files which may come from multiple root directories. Here are a list of the current root directories:[0] {str(tmp_path)}> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download (0, y, n) [y]: y"""in result.output)assert "Download Summary:" in result.outputassert result.exit_code == 0, result.output
2
64
2
328
6
560
653
560
fresh_deadline_config,tmp_path
['mock_download', 'mock_files_list', 'runner', 'mock_root_path', 'path_separator', 'result']
None
{"Assign": 11, "Expr": 4, "With": 1}
21
94
21
["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "str", "str", "str", "pytest.mark.skipif"]
0
[]
The function (test_cli_job_download_output_handles_unc_path_on_windows) defined within the public class called public.The function start at line 560 and ends at 653. It contains 64 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [560.0] and does not return any value. It declares 21.0 functions, and It has 21.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "str", "str", "str", "pytest.mark.skipif"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_download_no_output_stdout
def test_cli_job_download_no_output_stdout(fresh_deadline_config, tmp_path: Path):"""Tests whether the output messages printed to stdout match expected messageswhen executing download-output command for a job that don't have any output yet."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "_get_conflicting_filenames", return_value=[]), patch.object(job_group, "round", return_value=0), patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadMockOutputDownloader.return_value.get_output_paths_by_root.return_value = {}mock_host_path_format_name = PathFormat.get_host_path_format_string()boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": "/root/path","rootPathFormat": PathFormat(mock_host_path_format_name),"outputRelativeDirectories": ["."],}],},}boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]runner = CliRunner()result = runner.invoke(main,["job", "download-output", "--job-id", MOCK_JOB_ID, "--output", "verbose"],input="",)MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=None,task_id=None,session=ANY,)assert ("""Downloading output from Job 'Mock Job'There are no output files available for download at this moment. Please verify that the Job/Step/Task you are trying to download output from has completed successfully."""in result.output)assert result.exit_code == 0
1
54
2
273
4
656
718
656
fresh_deadline_config,tmp_path
['mock_download', 'runner', 'result', 'mock_host_path_format_name']
None
{"Assign": 9, "Expr": 4, "With": 1}
17
63
17
["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings"]
0
[]
The function (test_cli_job_download_no_output_stdout) defined within the public class called public.The function start at line 656 and ends at 718. It contains 54 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [656.0] and does not return any value. It declares 17.0 functions, and It has 17.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_download_output_stdout_with_json_format
def test_cli_job_download_output_stdout_with_json_format(fresh_deadline_config,tmp_path: Path,):"""Tests whether the output messages printed to stdout match expected messageswhen `download-output` command is executed with `--output json` option."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "round", return_value=0), patch.object(job_group, "_get_conflicting_filenames", return_value=[]), patch.object(job_group, "_assert_valid_path", return_value=None), patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadmock_root_path = "/root/path" if sys.platform != "win32" else "C:\\Users\\username"mock_files_list = ["outputs/file1.txt", "outputs/file2.txt", "outputs/file3.txt"]MockOutputDownloader.return_value.get_output_paths_by_root.side_effect = [{f"{mock_root_path}": mock_files_list,f"{mock_root_path}2": mock_files_list,},{f"{mock_root_path}": mock_files_list,f"{mock_root_path}2": mock_files_list,},{f"{mock_root_path}": mock_files_list,str(tmp_path): mock_files_list,},]mock_host_path_format = PathFormat.get_host_path_format()boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": f"{mock_root_path}","rootPathFormat": mock_host_path_format,"outputRelativeDirectories": ["."],},{"rootPath": f"{mock_root_path}2","rootPathFormat": mock_host_path_format,"outputRelativeDirectories": ["."],},],},}runner = CliRunner()result = runner.invoke(main,["job", "download-output", "--job-id", MOCK_JOB_ID, "--output", "json"],input=json.dumps({"messageType": "pathconfirm", "value": [mock_root_path, str(tmp_path)]}),)MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=None,task_id=None,session=ANY,)expected_json_title = json.dumps({"messageType": "title", "value": "Mock Job"})expected_json_presummary = json.dumps({"messageType": "presummary","value": {mock_root_path: ["outputs/file1.txt","outputs/file2.txt","outputs/file3.txt",],f"{mock_root_path}2": ["outputs/file1.txt","outputs/file2.txt","outputs/file3.txt",],},})expected_json_path = json.dumps({"messageType": "path", "value": [mock_root_path, f"{mock_root_path}2"]})expected_json_pathconfirm = json.dumps({"messageType": "pathconfirm", "value": [mock_root_path, str(tmp_path)]})assert (f"{expected_json_title}\n{expected_json_presummary}\n{expected_json_path}\n {expected_json_pathconfirm}\n"in result.output)assert result.exit_code == 0
2
101
2
487
10
721
832
721
fresh_deadline_config,tmp_path
['mock_download', 'mock_files_list', 'mock_host_path_format', 'expected_json_pathconfirm', 'expected_json_path', 'runner', 'expected_json_presummary', 'mock_root_path', 'expected_json_title', 'result']
None
{"Assign": 15, "Expr": 4, "With": 1}
25
112
25
["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "PathFormat.get_host_path_format", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "json.dumps", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "json.dumps", "json.dumps", "json.dumps", "json.dumps", "str"]
0
[]
The function (test_cli_job_download_output_stdout_with_json_format) defined within the public class called public.The function start at line 721 and ends at 832. It contains 101 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [721.0] and does not return any value. It declares 25.0 functions, and It has 25.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "str", "PathFormat.get_host_path_format", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "json.dumps", "str", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "json.dumps", "json.dumps", "json.dumps", "json.dumps", "str"].
aws-deadline_deadline-cloud
public
public
0
0
test_get_summary_of_files_to_download_message_posix
def test_get_summary_of_files_to_download_message_posix(output_paths_by_root: Dict[str, List[str]],expected_result: str,):"""Tests if the _get_summary_of_files_to_download_message() returns expected string"""is_json_format = Falseassert (_get_summary_of_files_to_download_message(output_paths_by_root, is_json_format)== expected_result)
1
9
2
35
1
877
886
877
output_paths_by_root,expected_result
['is_json_format']
None
{"Assign": 1, "Expr": 1}
3
10
3
["_get_summary_of_files_to_download_message", "pytest.mark.skipif", "pytest.mark.parametrize"]
0
[]
The function (test_get_summary_of_files_to_download_message_posix) defined within the public class called public.The function start at line 877 and ends at 886. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [877.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["_get_summary_of_files_to_download_message", "pytest.mark.skipif", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_get_summary_of_files_to_download_message_windows
def test_get_summary_of_files_to_download_message_windows(output_paths_by_root: Dict[str, List[str]],expected_result: str,):"""Tests if the _get_summary_of_files_to_download_message() returns expected string"""is_json_format = Falseassert (_get_summary_of_files_to_download_message(output_paths_by_root, is_json_format)== expected_result)
1
9
2
35
1
902
911
902
output_paths_by_root,expected_result
['is_json_format']
None
{"Assign": 1, "Expr": 1}
3
10
3
["_get_summary_of_files_to_download_message", "pytest.mark.skipif", "pytest.mark.parametrize"]
0
[]
The function (test_get_summary_of_files_to_download_message_windows) defined within the public class called public.The function start at line 902 and ends at 911. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [902.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["_get_summary_of_files_to_download_message", "pytest.mark.skipif", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_succeeded
def test_cli_job_wait_succeeded(fresh_deadline_config):"""Test that job wait command returns exit code 0 when job succeeds."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="SUCCEEDED", failed_tasks=[], elapsed_time=10.5)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait"])# Verify get_job was called to get job nameboto3_client_mock().get_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "Job completed with status: SUCCEEDED" in result.outputassert "Elapsed time: 10.5 seconds" in result.outputassert "No failed tasks found." in result.outputassert result.exit_code == 0
1
22
1
166
2
914
945
914
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 5, "With": 1}
11
32
11
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke", "get_job.assert_called_once_with", "boto3_client_mock"]
0
[]
The function (test_cli_job_wait_succeeded) defined within the public class called public.The function start at line 914 and ends at 945. It contains 22 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 11.0 functions, and It has 11.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke", "get_job.assert_called_once_with", "boto3_client_mock"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_timeout
def test_cli_job_wait_timeout(fresh_deadline_config):"""Test that job wait command returns exit code 1 when timeout occurs."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.side_effect = DeadlineOperationTimedOut("Timeout waiting for job job-123 to complete after 30.0 seconds")# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Timeout waiting for job" in result.outputassert result.exit_code == 1
1
15
1
105
2
948
970
948
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 4, "With": 1}
9
23
9
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationTimedOut", "boto3_client_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_timeout) defined within the public class called public.The function start at line 948 and ends at 970. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationTimedOut", "boto3_client_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_failed
def test_cli_job_wait_failed(fresh_deadline_config):"""Test that job wait command returns exit code 2 when job fails."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="FAILED",failed_tasks=[api.FailedTask(step_id="step-123",task_id="task-456",step_name="Render Step",parameters={"frame": {"int": 1}},session_id="session-789",)],elapsed_time=15.2,)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "Job completed with status: FAILED" in result.outputassert "Elapsed time: 15.2 seconds" in result.outputassert "Found 1 failed tasks:" in result.outputassert result.exit_code == 2
1
29
1
180
2
973
1,009
973
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 4, "With": 1}
10
37
10
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "api.FailedTask", "boto3_client_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_failed) defined within the public class called public.The function start at line 973 and ends at 1009. It contains 29 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "api.FailedTask", "boto3_client_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_canceled
def test_cli_job_wait_canceled(fresh_deadline_config):"""Test that job wait command returns exit code 3 when job is canceled."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="CANCELED", failed_tasks=[], elapsed_time=5.0)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "Job completed with status: CANCELED" in result.outputassert "Elapsed time: 5.0 seconds" in result.outputassert "No failed tasks found." in result.outputassert result.exit_code == 3
1
19
1
146
2
1,012
1,038
1,012
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 4, "With": 1}
9
27
9
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_canceled) defined within the public class called public.The function start at line 1012 and ends at 1038. It contains 19 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_archived
def test_cli_job_wait_archived(fresh_deadline_config):"""Test that job wait command returns exit code 4 when job is archived."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="ARCHIVED", failed_tasks=[], elapsed_time=8.3)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "Job completed with status: ARCHIVED" in result.outputassert "Elapsed time: 8.3 seconds" in result.outputassert "No failed tasks found." in result.outputassert result.exit_code == 4
1
19
1
146
2
1,041
1,067
1,041
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 4, "With": 1}
9
27
9
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_archived) defined within the public class called public.The function start at line 1041 and ends at 1067. It contains 19 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_not_compatible
def test_cli_job_wait_not_compatible(fresh_deadline_config):"""Test that job wait command returns exit code 5 when job is not compatible."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="NOT_COMPATIBLE", failed_tasks=[], elapsed_time=2.1)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "Job completed with status: NOT_COMPATIBLE" in result.outputassert "Elapsed time: 2.1 seconds" in result.outputassert "No failed tasks found." in result.outputassert result.exit_code == 5
1
19
1
146
2
1,070
1,096
1,070
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 4, "With": 1}
9
27
9
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_not_compatible) defined within the public class called public.The function start at line 1070 and ends at 1096. It contains 19 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_succeeded_with_failed_tasks_returns_exit_code_2
def test_cli_job_wait_succeeded_with_failed_tasks_returns_exit_code_2(fresh_deadline_config):"""Test that job wait command returns exit code 2 when there are failed tasks, even if status is SUCCEEDED."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="SUCCEEDED",failed_tasks=[api.FailedTask(step_id="step-123",task_id="task-456",step_name="Render Step",parameters={"frame": {"int": 1}},session_id="session-789",)],elapsed_time=12.0,)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "Job completed with status: SUCCEEDED" in result.outputassert "Found 1 failed tasks:" in result.outputassert result.exit_code == 2
1
28
1
174
2
1,099
1,134
1,099
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 4, "With": 1}
10
36
10
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "api.FailedTask", "boto3_client_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_succeeded_with_failed_tasks_returns_exit_code_2) defined within the public class called public.The function start at line 1099 and ends at 1134. It contains 28 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "api.FailedTask", "boto3_client_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_json_output_succeeded
def test_cli_job_wait_json_output_succeeded(fresh_deadline_config):"""Test that job wait command with JSON output returns exit code 0 when job succeeds."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="SUCCEEDED", failed_tasks=[], elapsed_time=10.5)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait", "--output", "json"])# Parse the JSON outputoutput_data = json.loads(result.output)assert output_data["jobId"] == MOCK_JOB_IDassert output_data["jobName"] == "Test Job Name"assert output_data["status"] == "SUCCEEDED"assert output_data["elapsedTime"] == pytest.approx(10.5)assert output_data["failedTasks"] == []assert result.exit_code == 0
1
20
1
171
3
1,137
1,165
1,137
fresh_deadline_config
['runner', 'result', 'output_data']
None
{"Assign": 5, "Expr": 4, "With": 1}
11
29
11
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "pytest.approx"]
0
[]
The function (test_cli_job_wait_json_output_succeeded) defined within the public class called public.The function start at line 1137 and ends at 1165. It contains 20 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 11.0 functions, and It has 11.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "pytest.approx"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_json_output_failed
def test_cli_job_wait_json_output_failed(fresh_deadline_config):"""Test that job wait command with JSON output returns exit code 2 when job fails."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as boto3_client_mock:mock_wait.return_value = api.JobCompletionResult(status="FAILED",failed_tasks=[api.FailedTask(step_id="step-123",task_id="task-456",step_name="Render Step",parameters={"frame": {"int": 1}},session_id="session-789",)],elapsed_time=15.2,)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "wait", "--output", "json"])# Parse the JSON outputoutput_data = json.loads(result.output)assert output_data["jobId"] == MOCK_JOB_IDassert output_data["jobName"] == "Test Job Name"assert output_data["status"] == "FAILED"assert output_data["elapsedTime"] == pytest.approx(15.2)assert len(output_data["failedTasks"]) == 1assert output_data["failedTasks"][0]["stepId"] == "step-123"assert output_data["failedTasks"][0]["taskId"] == "task-456"assert output_data["failedTasks"][0]["stepName"] == "Render Step"assert output_data["failedTasks"][0]["sessionId"] == "session-789"assert result.exit_code == 2
1
34
1
259
3
1,168
1,210
1,168
fresh_deadline_config
['runner', 'result', 'output_data']
None
{"Assign": 5, "Expr": 4, "With": 1}
13
43
13
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "api.FailedTask", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "pytest.approx", "len"]
0
[]
The function (test_cli_job_wait_json_output_failed) defined within the public class called public.The function start at line 1168 and ends at 1210. It contains 34 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 13.0 functions, and It has 13.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "api.FailedTask", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "pytest.approx", "len"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_unknown_status_returns_exit_code_2
def test_cli_job_wait_unknown_status_returns_exit_code_2(fresh_deadline_config):"""Test that job wait command returns exit code 2 for unknown status."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as mock_get_client:mock_client = mock_get_client.return_valuemock_client.get_job.return_value = {"jobId": MOCK_JOB_ID, "name": "Test Job"}mock_wait.return_value = api.JobCompletionResult(status="UNKNOWN_STATUS", failed_tasks=[], elapsed_time=3.0)runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job" in result.outputassert "Job completed with status: UNKNOWN_STATUS" in result.outputassert result.exit_code == 2
1
18
1
141
3
1,213
1,237
1,213
fresh_deadline_config
['runner', 'result', 'mock_client']
None
{"Assign": 5, "Expr": 4, "With": 1}
8
25
8
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_unknown_status_returns_exit_code_2) defined within the public class called public.The function start at line 1213 and ends at 1237. It contains 18 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "api.JobCompletionResult", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_timeout_json_output
def test_cli_job_wait_timeout_json_output(fresh_deadline_config):"""Test that job wait command handles timeout correctly with JSON output."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as mock_get_client:mock_client = mock_get_client.return_valuemock_client.get_job.return_value = {"jobId": MOCK_JOB_ID, "name": "Test Job"}mock_wait.side_effect = DeadlineOperationTimedOut("Timeout waiting for job job-123 to complete after 30.0 seconds")runner = CliRunner()result = runner.invoke(main, ["job", "wait", "--output", "json"])# Parse the JSON outputoutput_data = json.loads(result.output)assert (output_data["error"] == "Timeout waiting for job job-123 to complete after 30.0 seconds")assert output_data["timeout"] is Trueassert output_data["jobId"] == MOCK_JOB_IDassert output_data["jobName"] == "Test Job"assert result.exit_code == 1
1
22
1
150
4
1,240
1,269
1,240
fresh_deadline_config
['runner', 'result', 'mock_client', 'output_data']
None
{"Assign": 6, "Expr": 4, "With": 1}
9
30
9
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationTimedOut", "CliRunner", "runner.invoke", "json.loads"]
0
[]
The function (test_cli_job_wait_timeout_json_output) defined within the public class called public.The function start at line 1240 and ends at 1269. It contains 22 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationTimedOut", "CliRunner", "runner.invoke", "json.loads"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_error_handling
def test_cli_job_wait_error_handling(fresh_deadline_config):"""Test that job wait command handles non-timeout errors correctly."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as mock_get_client:mock_client = mock_get_client.return_valuemock_client.get_job.return_value = {"jobId": MOCK_JOB_ID, "name": "Test Job"}mock_wait.side_effect = DeadlineOperationError("Test error message")runner = CliRunner()result = runner.invoke(main, ["job", "wait"])assert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job" in result.outputassert "Error waiting for job completion: Test error message" in result.outputassert result.exit_code == 2
1
16
1
126
3
1,272
1,294
1,272
fresh_deadline_config
['runner', 'result', 'mock_client']
None
{"Assign": 5, "Expr": 4, "With": 1}
8
23
8
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationError", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_wait_error_handling) defined within the public class called public.The function start at line 1272 and ends at 1294. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationError", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_wait_error_handling_json_output
def test_cli_job_wait_error_handling_json_output(fresh_deadline_config):"""Test that job wait command handles non-timeout errors correctly with JSON output."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "wait_for_job_completion") as mock_wait, patch.object(api, "get_boto3_client") as mock_get_client:mock_client = mock_get_client.return_valuemock_client.get_job.return_value = {"jobId": MOCK_JOB_ID, "name": "Test Job"}mock_wait.side_effect = DeadlineOperationError("Test error message")runner = CliRunner()result = runner.invoke(main, ["job", "wait", "--output", "json"])# Parse the JSON outputoutput_data = json.loads(result.output)assert output_data["error"] == "Test error message"assert output_data["jobId"] == MOCK_JOB_IDassert output_data["jobName"] == "Test Job"assert result.exit_code == 2
1
17
1
141
4
1,297
1,321
1,297
fresh_deadline_config
['runner', 'result', 'mock_client', 'output_data']
None
{"Assign": 6, "Expr": 4, "With": 1}
9
25
9
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationError", "CliRunner", "runner.invoke", "json.loads"]
0
[]
The function (test_cli_job_wait_error_handling_json_output) defined within the public class called public.The function start at line 1297 and ends at 1321. It contains 17 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "DeadlineOperationError", "CliRunner", "runner.invoke", "json.loads"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_download_output_handle_web_url_with_optional_input
def test_cli_job_download_output_handle_web_url_with_optional_input(fresh_deadline_config):"""Confirm that the CLI interface prints out the expected list offarms, given mock data."""config.set_setting("settings.auto_accept", "true")with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "round", return_value=0), patch.object(api, "get_queue_user_boto3_session"):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadmock_host_path_format_name = PathFormat.get_host_path_format_string()boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": "/root/path","rootPathFormat": PathFormat(mock_host_path_format_name),"outputRelativeDirectories": ["."],},],},}boto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]runner = CliRunner()result = runner.invoke(main,["job","download-output","--farm-id",MOCK_FARM_ID,"--queue-id",MOCK_QUEUE_ID,"--job-id",MOCK_JOB_ID,"--step-id","step-1","--task-id","task-2",],)MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id="step-1",task_id="task-2",session=ANY,)mock_download.assert_called_once_with(file_conflict_resolution=FileConflictResolution.CREATE_COPY,on_downloading_files=ANY,)assert result.exit_code == 0
1
60
1
254
4
1,324
1,391
1,324
fresh_deadline_config
['mock_download', 'runner', 'result', 'mock_host_path_format_name']
None
{"Assign": 8, "Expr": 4, "With": 1}
16
68
16
["config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_download.assert_called_once_with"]
0
[]
The function (test_cli_job_download_output_handle_web_url_with_optional_input) defined within the public class called public.The function start at line 1324 and ends at 1391. It contains 60 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 16.0 functions, and It has 16.0 functions called inside which are ["config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "DownloadSummaryStatistics", "PathFormat.get_host_path_format_string", "boto3_client_mock", "PathFormat", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_download.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_trace_schedule
def test_cli_job_trace_schedule(fresh_deadline_config):"""A very minimal sanity check of the trace-schedule CLI command.To test the function more thoroughly involves creating a mockset of APIs that return a coherent set of data based on the queryIDs instead of single mocked returns as this test does."""with patch.object(api._session, "get_boto3_session") as session_mock:deadline_mock = session_mock().client("deadline")deadline_mock.get_job.return_value = MOCK_JOBS_LIST[0]deadline_mock.list_sessions.return_value = {"sessions": MOCK_SESSIONS_LIST}deadline_mock.list_session_actions.return_value = {"sessionActions": MOCK_SESSION_ACTIONS_LIST}deadline_mock.get_step.return_value = MOCK_STEPdeadline_mock.get_task.return_value = MOCK_TASKrunner = CliRunner()result = runner.invoke(main,["job","trace-schedule","--farm-id",MOCK_FARM_ID,"--queue-id",MOCK_QUEUE_ID,"--job-id",str(MOCK_JOBS_LIST[0]["jobId"]),],)assert (result.output== """Getting the job...Getting all the sessions for the job...Getting all the session actions for the job...Getting all the steps and tasks for the job...Processing the trace data... ==== SUMMARY ====Session Count: 1Session Total Duration: 0:01:00Session Action Count: 1Session Action Total Duration: 0:00:30Task Run Count: 1Task Run Total Duration: 0:00:30 (50.0%)Non-Task Run Count: 0Non-Task Run Total Duration: 0:00:00 (0.0%)Sync Job Attachments Count: 0Sync Job Attachments Total Duration: 0:00:00 (0.0%)Env Action Count: 0Env Action Total Duration: 0:00:00 (0.0%)Within-session Overhead Duration: 0:00:30 (50.0%)Within-session Overhead Duration Per Action: 0:00:30""")assert result.exit_code == 0
1
28
1
132
3
1,394
1,454
1,394
fresh_deadline_config
['runner', 'result', 'deadline_mock']
None
{"Assign": 8, "Expr": 1, "With": 1}
6
61
6
["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "str"]
0
[]
The function (test_cli_job_trace_schedule) defined within the public class called public.The function start at line 1394 and ends at 1454. It contains 28 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["patch.object", "client", "session_mock", "CliRunner", "runner.invoke", "str"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_download_output_with_different_asset_root_path_format_than_job
def test_cli_job_download_output_with_different_asset_root_path_format_than_job(tmp_path: Path):"""Tests whether the output messages printed to stdout match expected messageswhen `download-output` command is executed."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(job_group, "OutputDownloader") as MockOutputDownloader, patch.object(job_group, "round", return_value=0), patch.object(job_group, "_get_conflicting_filenames", return_value=[]), patch.object(job_group, "_assert_valid_path", return_value=None), patch.object(api, "get_queue_user_boto3_session"), patch.object(job_group.os.path,"expanduser",return_value=tmp_path,) as mock_expanduser, patch.object(api._telemetry.TelemetryClient, "record_event", MagicMock()):mock_download = MagicMock()mock_download.return_value = DownloadSummaryStatistics(total_time=12,processed_files=3,processed_bytes=1024,)MockOutputDownloader.return_value.download_job_output = mock_downloadwindows_root_path = "C:\\Users\\username"not_windows_root_path = "/root/path"mock_root_path = not_windows_root_path if sys.platform == "win32" else windows_root_pathmock_files_list = ["outputs/file1.txt", "outputs/file2.txt", "outputs/file3.txt"]MockOutputDownloader.return_value.get_output_paths_by_root.side_effect = [{f"{mock_root_path}": mock_files_list,},{f"{tmp_path}": mock_files_list,},]mock_host_path_format = PathFormat.POSIX if sys.platform == "win32" else PathFormat.WINDOWSboto3_client_mock().get_queue.side_effect = [MOCK_GET_QUEUE_RESPONSE]boto3_client_mock().get_job.return_value = {"name": "Mock Job","attachments": {"manifests": [{"rootPath": f"{mock_root_path}","rootPathFormat": mock_host_path_format,"outputRelativeDirectories": ["."],},],},}runner = CliRunner()result = runner.invoke(main,["job", "download-output", "--job-id", MOCK_JOB_ID, "--output", "verbose"],input="~\ny\n",)MockOutputDownloader.assert_called_once_with(s3_settings=JobAttachmentS3Settings(**MOCK_GET_QUEUE_RESPONSE["jobAttachmentSettings"]),# type: ignorefarm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,job_id=MOCK_JOB_ID,step_id=None,task_id=None,session=ANY,)path_separator = "/" if sys.platform != "win32" else "\\"assert (f"""Downloading output from Job 'Mock Job'This root path format does not match the operating system you're using. Where would you like to save the files?The location was {not_windows_root_path if sys.platform == "win32" else windows_root_path}, on {"Posix" if sys.platform == "win32" else "Windows"}.> Please enter a new root path: ~Summary of files to download:{tmp_path}{path_separator}outputs (3 files)You are about to download files which may come from multiple root directories. Here are a list of the current root directories:[0] {tmp_path}> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download (0, y, n) [y]: y"""in result.output)assert "Download Summary:" in result.outputassert result.exit_code == 0mock_expanduser.assert_any_call("~")
4
69
1
394
9
1,458
1,549
1,458
tmp_path
['mock_download', 'not_windows_root_path', 'mock_files_list', 'mock_host_path_format', 'runner', 'mock_root_path', 'windows_root_path', 'path_separator', 'result']
None
{"Assign": 14, "Expr": 5, "With": 1}
21
92
21
["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "MagicMock", "DownloadSummaryStatistics", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_expanduser.assert_any_call", "pytest.mark.usefixtures"]
0
[]
The function (test_cli_job_download_output_with_different_asset_root_path_format_than_job) defined within the public class called public.The function start at line 1458 and ends at 1549. It contains 69 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 21.0 functions, and It has 21.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "patch.object", "MagicMock", "MagicMock", "DownloadSummaryStatistics", "boto3_client_mock", "boto3_client_mock", "CliRunner", "runner.invoke", "MockOutputDownloader.assert_called_once_with", "JobAttachmentS3Settings", "mock_expanduser.assert_any_call", "pytest.mark.usefixtures"].
aws-deadline_deadline-cloud
TestJsonLineHelpers
public
0
0
test_get_json_line_basic
def test_get_json_line_basic(self):"""Test _get_json_line with basic parameters."""result = _get_json_line("test", "value")parsed = json.loads(result)assert parsed["messageType"] == "test"assert parsed["value"] == "value"assert len(parsed) == 2# Only messageType and value
1
6
1
43
0
1,555
1,562
1,555
self
[]
None
{"Assign": 2, "Expr": 1}
3
8
3
["_get_json_line", "json.loads", "len"]
0
[]
The function (test_get_json_line_basic) defined within the public class called TestJsonLineHelpers.The function start at line 1555 and ends at 1562. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["_get_json_line", "json.loads", "len"].
aws-deadline_deadline-cloud
TestJsonLineHelpers
public
0
0
test_get_json_line_with_none_extra_properties
def test_get_json_line_with_none_extra_properties(self):"""Test _get_json_line with explicit None extra_properties."""result = _get_json_line("test", "value", extra_properties=None)parsed = json.loads(result)assert parsed["messageType"] == "test"assert parsed["value"] == "value"assert len(parsed) == 2# Only messageType and value
1
6
1
47
0
1,564
1,571
1,564
self
[]
None
{"Assign": 2, "Expr": 1}
3
8
3
["_get_json_line", "json.loads", "len"]
0
[]
The function (test_get_json_line_with_none_extra_properties) defined within the public class called TestJsonLineHelpers.The function start at line 1564 and ends at 1571. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["_get_json_line", "json.loads", "len"].
aws-deadline_deadline-cloud
TestJsonLineHelpers
public
0
0
test_get_json_line_with_kwargs
def test_get_json_line_with_kwargs(self):"""Test _get_json_line with additional properties."""result = _get_json_line("summary", "Downloaded 5 files", extra_properties={"fileCount": 5, "status": "complete"})parsed = json.loads(result)assert parsed["messageType"] == "summary"assert parsed["value"] == "Downloaded 5 files"assert parsed["fileCount"] == 5assert parsed["status"] == "complete"
1
9
1
62
0
1,573
1,583
1,573
self
[]
None
{"Assign": 2, "Expr": 1}
2
11
2
["_get_json_line", "json.loads"]
0
[]
The function (test_get_json_line_with_kwargs) defined within the public class called TestJsonLineHelpers.The function start at line 1573 and ends at 1583. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["_get_json_line", "json.loads"].
aws-deadline_deadline-cloud
TestJsonLineHelpers
public
0
0
test_get_json_line_with_list_value
def test_get_json_line_with_list_value(self):"""Test _get_json_line with list value and extra properties."""result = _get_json_line("path", ["/path1", "/path2"], extra_properties={"count": 2})parsed = json.loads(result)assert parsed["messageType"] == "path"assert parsed["value"] == ["/path1", "/path2"]assert parsed["count"] == 2
1
6
1
59
0
1,585
1,592
1,585
self
[]
None
{"Assign": 2, "Expr": 1}
2
8
2
["_get_json_line", "json.loads"]
0
[]
The function (test_get_json_line_with_list_value) defined within the public class called TestJsonLineHelpers.The function start at line 1585 and ends at 1592. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["_get_json_line", "json.loads"].
aws-deadline_deadline-cloud
TestJsonLineHelpers
public
0
0
test_get_download_summary_message_json_with_file_count
def test_get_download_summary_message_json_with_file_count(self):"""Test _get_download_summary_message includes fileCount in JSON format."""from deadline.job_attachments.progress_tracker import DownloadSummaryStatistics# Create mock download summarysummary = DownloadSummaryStatistics()summary.processed_files = 3summary.processed_bytes = 1024summary.total_time = 2.5summary.transfer_rate = 409.6summary.file_counts_by_root_directory = {"/downloads": 3}result = _get_download_summary_message(summary, is_json_format=True)parsed = json.loads(result)assert parsed["messageType"] == "summary"assert parsed["value"] == "Downloaded 3 files"assert parsed["fileCount"] == 3
1
13
1
91
0
1,594
1,611
1,594
self
[]
None
{"Assign": 8, "Expr": 1}
3
18
3
["DownloadSummaryStatistics", "_get_download_summary_message", "json.loads"]
0
[]
The function (test_get_download_summary_message_json_with_file_count) defined within the public class called TestJsonLineHelpers.The function start at line 1594 and ends at 1611. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["DownloadSummaryStatistics", "_get_download_summary_message", "json.loads"].
aws-deadline_deadline-cloud
TestJsonLineHelpers
public
0
0
test_get_download_summary_message_json_zero_files
def test_get_download_summary_message_json_zero_files(self):"""Test _get_download_summary_message with zero files."""from deadline.job_attachments.progress_tracker import DownloadSummaryStatisticssummary = DownloadSummaryStatistics()summary.processed_files = 0result = _get_download_summary_message(summary, is_json_format=True)parsed = json.loads(result)assert parsed["messageType"] == "summary"assert parsed["value"] == "Downloaded 0 files"assert parsed["fileCount"] == 0
1
9
1
63
0
1,613
1,625
1,613
self
[]
None
{"Assign": 4, "Expr": 1}
3
13
3
["DownloadSummaryStatistics", "_get_download_summary_message", "json.loads"]
0
[]
The function (test_get_download_summary_message_json_zero_files) defined within the public class called TestJsonLineHelpers.The function start at line 1613 and ends at 1625. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["DownloadSummaryStatistics", "_get_download_summary_message", "json.loads"].
aws-deadline_deadline-cloud
TestJsonLineHelpers
public
0
0
test_get_download_summary_message_non_json_unchanged
def test_get_download_summary_message_non_json_unchanged(self):"""Test _get_download_summary_message non-JSON format is unchanged."""from deadline.job_attachments.progress_tracker import DownloadSummaryStatisticssummary = DownloadSummaryStatistics()summary.processed_files = 2summary.processed_bytes = 512summary.total_time = 1.0summary.transfer_rate = 512.0summary.file_counts_by_root_directory = {"/downloads": 2}result = _get_download_summary_message(summary, is_json_format=False)# Should be human-readable format, not JSONassert "Download Summary:" in resultassert "Downloaded 2 files totaling" in resultassert not result.startswith('{"messageType":')
1
12
1
78
0
1,627
1,643
1,627
self
[]
None
{"Assign": 7, "Expr": 1}
3
17
3
["DownloadSummaryStatistics", "_get_download_summary_message", "result.startswith"]
0
[]
The function (test_get_download_summary_message_non_json_unchanged) defined within the public class called TestJsonLineHelpers.The function start at line 1627 and ends at 1643. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["DownloadSummaryStatistics", "_get_download_summary_message", "result.startswith"].
aws-deadline_deadline-cloud
public
public
0
0
add_mocks_for_job_cancel
def add_mocks_for_job_cancel(deadline_mock):"""Adds mock return values to the deadline_mock for sharing acrossthe different 'deadline job cancel' tests."""# These mock returns only contain the properties that job cancel needsdeadline_mock.get_job.return_value = {"jobId": MOCK_JOB_ID,"name": "Test Job Name","taskRunStatus": "RUNNING","taskRunStatusCounts": {"SUCCEEDED": 2,"RUNNING": 3,"FAILED": 1,"SUSPENDED": 0,# Will be filtered out in display"CANCELED": 0,# Will be filtered out in display},"startedAt": "2024-01-01T10:00:00Z","endedAt": "","createdBy": "test-user","createdAt": "2024-01-01T09:00:00Z",}deadline_mock.update_job.return_value = {}
1
18
1
75
0
21
43
21
deadline_mock
[]
None
{"Assign": 2, "Expr": 1}
0
23
0
[]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_default", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_mark_as_status", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_user_declines", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_with_yes_flag"]
The function (add_mocks_for_job_cancel) defined within the public class called public.The function start at line 21 and ends at 43. It contains 18 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 4.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_default", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_mark_as_status", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_user_declines", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_client.cli.test_cli_job_cancel_py.test_cli_job_cancel_with_yes_flag"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_cancel_default
def test_cli_job_cancel_default(fresh_deadline_config, deadline_mock):"""Tests that 'deadline job cancel' cancels a job with default CANCELED mark-as status."""add_mocks_for_job_cancel(deadline_mock)with patch.object(click, "confirm") as mock_confirm:mock_confirm.return_value = Truerunner = CliRunner()result = runner.invoke(main,["job","cancel","--farm-id",MOCK_FARM_ID,"--queue-id",MOCK_QUEUE_ID,"--job-id",MOCK_JOB_ID,],)# Verify the job summary output (filtered taskRunStatusCounts with no zero values)expected_output = f"""name: Test Job NamejobId: {MOCK_JOB_ID}taskRunStatus: RUNNINGtaskRunStatusCounts:SUCCEEDED: 2RUNNING: 3FAILED: 1startedAt: '2024-01-01T10:00:00Z'endedAt: ''createdBy: test-usercreatedAt: '2024-01-01T09:00:00Z'Canceling job..."""assert result.output == expected_outputassert result.exit_code == 0# Verify confirmation prompt appears with correct message for CANCELED statusmock_confirm.assert_called_once_with("Are you sure you want to cancel this job?", default=None)# Verify deadline.get_job() and deadline.update_job() are called with correct parametersdeadline_mock.get_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)deadline_mock.update_job.assert_called_once_with(farmId=MOCK_FARM_ID,queueId=MOCK_QUEUE_ID,jobId=MOCK_JOB_ID,targetTaskRunStatus="CANCELED",)
1
30
2
129
3
46
100
46
fresh_deadline_config,deadline_mock
['expected_output', 'runner', 'result']
None
{"Assign": 4, "Expr": 5, "With": 1}
7
55
7
["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_called_once_with"]
0
[]
The function (test_cli_job_cancel_default) defined within the public class called public.The function start at line 46 and ends at 100. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [46.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_cancel_user_declines
def test_cli_job_cancel_user_declines(fresh_deadline_config, deadline_mock):"""Tests that 'deadline job cancel' exits with code 1 and displays appropriate message when user declines."""add_mocks_for_job_cancel(deadline_mock)with patch.object(click, "confirm") as mock_confirm:mock_confirm.return_value = Falserunner = CliRunner()result = runner.invoke(main,["job","cancel","--farm-id",MOCK_FARM_ID,"--queue-id",MOCK_QUEUE_ID,"--job-id",MOCK_JOB_ID,],)# Verify the job summary output followed by "Job not canceled." messageexpected_output = f"""name: Test Job NamejobId: {MOCK_JOB_ID}taskRunStatus: RUNNINGtaskRunStatusCounts:SUCCEEDED: 2RUNNING: 3FAILED: 1startedAt: '2024-01-01T10:00:00Z'endedAt: ''createdBy: test-usercreatedAt: '2024-01-01T09:00:00Z'Job not canceled."""assert result.output == expected_outputassert result.exit_code == 1# Verify confirmation prompt appearsmock_confirm.assert_called_once_with("Are you sure you want to cancel this job?", default=None)# Verify deadline.get_job() is called but deadline.update_job() is NOT calleddeadline_mock.get_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)deadline_mock.update_job.assert_not_called()
1
25
2
113
3
103
152
103
fresh_deadline_config,deadline_mock
['expected_output', 'runner', 'result']
None
{"Assign": 4, "Expr": 5, "With": 1}
7
50
7
["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_not_called"]
0
[]
The function (test_cli_job_cancel_user_declines) defined within the public class called public.The function start at line 103 and ends at 152. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [103.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_not_called"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_cancel_with_yes_flag
def test_cli_job_cancel_with_yes_flag(fresh_deadline_config, deadline_mock):"""Tests that 'deadline job cancel' with --yes flag skips confirmation prompt and cancels successfully."""add_mocks_for_job_cancel(deadline_mock)with patch.object(click, "confirm") as mock_confirm:runner = CliRunner()result = runner.invoke(main,["job","cancel","--farm-id",MOCK_FARM_ID,"--queue-id",MOCK_QUEUE_ID,"--job-id",MOCK_JOB_ID,"--yes",],)# Verify the job summary output and cancellation messageexpected_output = f"""name: Test Job NamejobId: {MOCK_JOB_ID}taskRunStatus: RUNNINGtaskRunStatusCounts:SUCCEEDED: 2RUNNING: 3FAILED: 1startedAt: '2024-01-01T10:00:00Z'endedAt: ''createdBy: test-usercreatedAt: '2024-01-01T09:00:00Z'Canceling job..."""assert result.output == expected_outputassert result.exit_code == 0# Verify confirmation prompt is skipped when --yes flag is usedmock_confirm.assert_not_called()# Verify deadline.get_job() and deadline.update_job() are called with correct parametersdeadline_mock.get_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)deadline_mock.update_job.assert_called_once_with(farmId=MOCK_FARM_ID,queueId=MOCK_QUEUE_ID,jobId=MOCK_JOB_ID,targetTaskRunStatus="CANCELED",)
1
30
2
121
3
155
209
155
fresh_deadline_config,deadline_mock
['expected_output', 'runner', 'result']
None
{"Assign": 3, "Expr": 5, "With": 1}
7
55
7
["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_not_called", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_called_once_with"]
0
[]
The function (test_cli_job_cancel_with_yes_flag) defined within the public class called public.The function start at line 155 and ends at 209. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [155.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_not_called", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_cancel_mark_as_status
def test_cli_job_cancel_mark_as_status(mark_as, fresh_deadline_config, deadline_mock):"""Tests that 'deadline job cancel' with different --mark-as status options works correctly."""add_mocks_for_job_cancel(deadline_mock)with patch.object(click, "confirm") as mock_confirm:mock_confirm.return_value = Truerunner = CliRunner()result = runner.invoke(main,["job","cancel","--farm-id",MOCK_FARM_ID,"--queue-id",MOCK_QUEUE_ID,"--job-id",MOCK_JOB_ID,"--mark-as",mark_as,],)# Verify the job summary output (filtered taskRunStatusCounts with no zero values)job_summary = f"""name: Test Job NamejobId: {MOCK_JOB_ID}taskRunStatus: RUNNINGtaskRunStatusCounts:SUCCEEDED: 2RUNNING: 3FAILED: 1startedAt: '2024-01-01T10:00:00Z'endedAt: ''createdBy: test-usercreatedAt: '2024-01-01T09:00:00Z'"""# Verify correct status message is displayed during cancellationif mark_as == "CANCELED":status_message = "Canceling job..."confirmation_message = "Are you sure you want to cancel this job?"else:status_message = f"Canceling job and marking as {mark_as}..."confirmation_message = (f"Are you sure you want to cancel this job and mark its taskRunStatus as {mark_as}?")expected_output = job_summary + status_message + "\n"assert result.output == expected_outputassert result.exit_code == 0# Verify appropriate confirmation message for each status typemock_confirm.assert_called_once_with(confirmation_message, default=None)# Verify correct targetTaskRunStatus parameter is passed to deadline.update_job()deadline_mock.get_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)deadline_mock.update_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID, targetTaskRunStatus=mark_as)
2
38
3
164
6
213
277
213
mark_as,fresh_deadline_config,deadline_mock
['job_summary', 'runner', 'status_message', 'expected_output', 'confirmation_message', 'result']
None
{"Assign": 9, "Expr": 5, "If": 1, "With": 1}
8
65
8
["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_called_once_with", "pytest.mark.parametrize"]
0
[]
The function (test_cli_job_cancel_mark_as_status) defined within the public class called public.The function start at line 213 and ends at 277. It contains 38 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [213.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["add_mocks_for_job_cancel", "patch.object", "CliRunner", "runner.invoke", "mock_confirm.assert_called_once_with", "deadline_mock.get_job.assert_called_once_with", "deadline_mock.update_job.assert_called_once_with", "pytest.mark.parametrize"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_verbose
def test_cli_job_logs_verbose(fresh_deadline_config):"""Test that logs CLI works correctly in verbose mode."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch("deadline.client.api.get_session_logs") as mock_get_logs, patch("deadline.client.api._job_monitoring.get_user_and_identity_store_id") as mock_get_user, patch("deadline.client.api.get_boto3_client") as boto3_client_mock:mock_get_user.return_value = (None, None)mock_get_logs.return_value = SAMPLE_LOG_RESULT# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "logs", "--session-id", "test-session", "--limit", "100"])assert "Retrieving logs for session" in result.outputassert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "[2023-01-01T12:00:00.123456+00:00] Log message 1" in result.outputassert "[2023-01-01T12:01:00.789012+00:00] Log message 2" in result.outputassert "Retrieved 2 log events" in result.outputassert "More logs are available" in result.outputassert result.exit_code == 0# Verify the API was called with correct parametersmock_get_logs.assert_called_once()_, kwargs = mock_get_logs.call_argsassert kwargs["farm_id"] == MOCK_FARM_IDassert kwargs["queue_id"] == MOCK_QUEUE_IDassert kwargs["session_id"] == "test-session"assert kwargs["limit"] == 100
1
28
1
196
2
65
102
65
fresh_deadline_config
['runner', 'result']
None
{"Assign": 6, "Expr": 5, "With": 1}
10
38
10
["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once"]
0
[]
The function (test_cli_job_logs_verbose) defined within the public class called public.The function start at line 65 and ends at 102. It contains 28 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_json
def test_cli_job_logs_json(fresh_deadline_config):"""Test that logs CLI works correctly in JSON mode."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch("deadline.client.api.get_session_logs") as mock_get_logs, patch("deadline.client.api._job_monitoring.get_user_and_identity_store_id") as mock_get_user, patch("deadline.client.api.get_boto3_client") as boto3_client_mock:mock_get_user.return_value = (None, None)mock_get_logs.return_value = SAMPLE_LOG_RESULT# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main,["job","logs","--session-id","test-session","--limit","100","--output","json",],)# Verify the output is valid JSONoutput_json = json.loads(result.output)assert "events" in output_jsonassert len(output_json["events"]) == 2assert output_json["events"][0]["message"] == "Log message 1"assert output_json["events"][0]["timestamp"] == "2023-01-01T12:00:00.123456+00:00"assert output_json["events"][0]["ingestionTime"] == "2023-01-01T12:00:10.654321+00:00"assert output_json["events"][1]["message"] == "Log message 2"assert output_json["events"][1]["timestamp"] == "2023-01-01T12:01:00.789012+00:00"assert output_json["events"][1]["ingestionTime"] == "2023-01-01T12:01:10.345678+00:00"assert output_json["count"] == 2assert output_json["nextToken"] == "next-token"assert output_json["logGroup"] == f"/aws/deadline/{MOCK_FARM_ID}/{MOCK_QUEUE_ID}"assert output_json["logStream"] == "session-test-session"# Verify job information is includedassert output_json["jobId"] == MOCK_JOB_IDassert output_json["jobName"] == "Test Job Name"# Verify no intermediate text output was producedassert "Retrieving logs for session" not in result.outputassert result.exit_code == 0
1
41
1
270
3
105
159
105
fresh_deadline_config
['runner', 'result', 'output_json']
None
{"Assign": 6, "Expr": 4, "With": 1}
11
55
11
["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "len"]
0
[]
The function (test_cli_job_logs_json) defined within the public class called public.The function start at line 105 and ends at 159. It contains 41 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 11.0 functions, and It has 11.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "len"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_empty
def test_cli_job_logs_empty(fresh_deadline_config):"""Test that logs CLI handles empty results correctly."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch("deadline.client.api.get_session_logs") as mock_get_logs, patch("deadline.client.api._job_monitoring.get_user_and_identity_store_id") as mock_get_user, patch("deadline.client.api.get_boto3_client") as boto3_client_mock:mock_get_user.return_value = (None, None)mock_get_logs.return_value = EMPTY_LOG_RESULT# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main, ["job", "logs", "--session-id", "test-session", "--limit", "100"])assert "No logs found for the specified session" in result.outputassert result.exit_code == 0
1
16
1
118
2
162
185
162
fresh_deadline_config
['runner', 'result']
None
{"Assign": 5, "Expr": 4, "With": 1}
9
24
9
["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_logs_empty) defined within the public class called public.The function start at line 162 and ends at 185. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_json_empty
def test_cli_job_logs_json_empty(fresh_deadline_config):"""Test that logs CLI handles empty results correctly in JSON mode."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch("deadline.client.api.get_session_logs") as mock_get_logs, patch("deadline.client.api._job_monitoring.get_user_and_identity_store_id") as mock_get_user, patch("deadline.client.api.get_boto3_client") as boto3_client_mock:mock_get_user.return_value = (None, None)mock_get_logs.return_value = EMPTY_LOG_RESULT# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main,["job","logs","--session-id","test-session","--limit","100","--output","json",],)# Verify the output is valid JSONoutput_json = json.loads(result.output)assert "events" in output_jsonassert len(output_json["events"]) == 0assert output_json["count"] == 0assert output_json["nextToken"] is None# Verify job information is includedassert output_json["jobId"] == MOCK_JOB_IDassert output_json["jobName"] == "Test Job Name"assert result.exit_code == 0
1
32
1
170
3
188
231
188
fresh_deadline_config
['runner', 'result', 'output_json']
None
{"Assign": 6, "Expr": 4, "With": 1}
11
44
11
["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "len"]
0
[]
The function (test_cli_job_logs_json_empty) defined within the public class called public.The function start at line 188 and ends at 231. It contains 32 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 11.0 functions, and It has 11.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "json.loads", "len"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_json_error
def test_cli_job_logs_json_error(fresh_deadline_config):"""Test that logs CLI handles errors correctly in JSON mode."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch("deadline.client.api.get_session_logs") as mock_get_logs, patch("deadline.client.api._job_monitoring.get_user_and_identity_store_id") as mock_get_user, patch("deadline.client.api.get_boto3_client") as boto3_client_mock:mock_get_user.return_value = (None, None)mock_get_logs.side_effect = Exception("Test error message")# Mock boto3 client to prevent AWS SDK callsboto3_client_mock.return_value = MagicMock()runner = CliRunner()result = runner.invoke(main,["job", "logs", "--session-id", "test-session", "--output", "json"],)# Verify the output contains an error messageassert "error" in result.output# The actual error message is different in the test environment# Exit code should be non-zero for errorsassert result.exit_code != 0
1
16
1
108
2
234
261
234
fresh_deadline_config
['runner', 'result']
None
{"Assign": 5, "Expr": 3, "With": 1}
9
28
9
["config.set_setting", "config.set_setting", "patch", "patch", "patch", "Exception", "MagicMock", "CliRunner", "runner.invoke"]
0
[]
The function (test_cli_job_logs_json_error) defined within the public class called public.The function start at line 234 and ends at 261. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and It has 9.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch", "patch", "patch", "Exception", "MagicMock", "CliRunner", "runner.invoke"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_with_time_params
def test_cli_job_logs_with_time_params(fresh_deadline_config):"""Test that logs CLI handles time parameters correctly."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch("deadline.client.api.get_session_logs") as mock_get_logs, patch("deadline.client.api._job_monitoring.get_user_and_identity_store_id") as mock_get_user, patch("deadline.client.api.get_boto3_client") as boto3_client_mock:mock_get_user.return_value = (None, None)mock_get_logs.return_value = SAMPLE_LOG_RESULT# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main,["job","logs","--session-id","test-session","--start-time","2023-01-01T12:00:00Z","--end-time","2023-01-01T13:00:00Z",],)assert result.exit_code == 0# Verify the API was called with correct parametersmock_get_logs.assert_called_once()_, kwargs = mock_get_logs.call_argsassert kwargs["start_time"] == "2023-01-01T12:00:00Z"assert kwargs["end_time"] == "2023-01-01T13:00:00Z"
1
29
1
144
2
264
302
264
fresh_deadline_config
['runner', 'result']
None
{"Assign": 6, "Expr": 5, "With": 1}
10
39
10
["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once"]
0
[]
The function (test_cli_job_logs_with_time_params) defined within the public class called public.The function start at line 264 and ends at 302. It contains 29 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_with_next_token
def test_cli_job_logs_with_next_token(fresh_deadline_config):"""Test that logs CLI handles next_token parameter correctly."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch("deadline.client.api.get_session_logs") as mock_get_logs, patch("deadline.client.api._job_monitoring.get_user_and_identity_store_id") as mock_get_user, patch("deadline.client.api.get_boto3_client") as boto3_client_mock:mock_get_user.return_value = (None, None)mock_get_logs.return_value = SAMPLE_LOG_RESULT# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main,["job","logs","--session-id","test-session","--next-token","test-token",],)assert result.exit_code == 0# Verify the API was called with correct parametersmock_get_logs.assert_called_once()_, kwargs = mock_get_logs.call_argsassert kwargs["next_token"] == "test-token"
1
26
1
133
2
305
340
305
fresh_deadline_config
['runner', 'result']
None
{"Assign": 6, "Expr": 5, "With": 1}
10
36
10
["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once"]
0
[]
The function (test_cli_job_logs_with_next_token) defined within the public class called public.The function start at line 305 and ends at 340. It contains 26 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch", "patch", "patch", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_with_session_id
def test_cli_job_logs_with_session_id(fresh_deadline_config):"""Test job logs command with explicit session ID."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "get_session_logs") as mock_get_logs, patch.object(api, "get_boto3_client") as boto3_client_mock:# Mock the API responsemock_get_logs.return_value = SessionLogResult(events=[LogEvent(timestamp=datetime.datetime(2023, 1, 27, 7, 24, 45, tzinfo=datetime.timezone.utc),message="Test log message 1",ingestion_time=datetime.datetime(2023, 1, 27, 7, 24, 46, tzinfo=datetime.timezone.utc),event_id="event-1",),LogEvent(timestamp=datetime.datetime(2023, 1, 27, 7, 24, 50, tzinfo=datetime.timezone.utc),message="Test log message 2",ingestion_time=datetime.datetime(2023, 1, 27, 7, 24, 51, tzinfo=datetime.timezone.utc),event_id="event-2",),],count=2,next_token=None,log_group=f"/aws/deadline/{MOCK_FARM_ID}/{MOCK_QUEUE_ID}",log_stream="session-1",)# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}runner = CliRunner()result = runner.invoke(main,["job","logs","--session-id","session-1",],)# Verify the API was called correctlymock_get_logs.assert_called_once_with(farm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,session_id="session-1",limit=100,start_time=None,end_time=None,next_token=None,config=ANY,)# Check outputassert "Retrieving logs for session session-1" in result.outputassert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "2023-01-27T07:24:45+00:00" in result.outputassert "Test log message 1" in result.outputassert "2023-01-27T07:24:50+00:00" in result.outputassert "Test log message 2" in result.outputassert "Retrieved 2 log events" in result.outputassert result.exit_code == 0
1
65
1
345
2
343
419
343
fresh_deadline_config
['runner', 'result']
None
{"Assign": 4, "Expr": 5, "With": 1}
16
77
16
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "SessionLogResult", "LogEvent", "datetime.datetime", "datetime.datetime", "LogEvent", "datetime.datetime", "datetime.datetime", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once_with"]
0
[]
The function (test_cli_job_logs_with_session_id) defined within the public class called public.The function start at line 343 and ends at 419. It contains 65 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 16.0 functions, and It has 16.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "SessionLogResult", "LogEvent", "datetime.datetime", "datetime.datetime", "LogEvent", "datetime.datetime", "datetime.datetime", "boto3_client_mock", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_with_job_id_single_session
def test_cli_job_logs_with_job_id_single_session(fresh_deadline_config):"""Test job logs command with job ID when there's only one session."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)config.set_setting("defaults.job_id", MOCK_JOB_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(api, "get_session_logs") as mock_get_logs:# Mock the paginatorpaginator_mock = MagicMock()boto3_client_mock().get_paginator.return_value = paginator_mock# Set up the paginator to return a single sessionpaginator_mock.paginate.return_value = [{"sessions": [{"sessionId": "session-1"}]}]# Mock get_job to return job nameboto3_client_mock().get_job.return_value = {"name": "Test Job Name"}# Mock the get_session_logs responsemock_get_logs.return_value = api.SessionLogResult(events=[api.LogEvent(timestamp=datetime.datetime(2023, 1, 27, 7, 24, 45),message="Test log message",ingestion_time=datetime.datetime(2023, 1, 27, 7, 24, 46),event_id="event-1",),],count=1,next_token=None,log_group=f"/aws/deadline/{MOCK_FARM_ID}/{MOCK_QUEUE_ID}",log_stream="session-1",)runner = CliRunner()result = runner.invoke(main,["job","logs","--job-id",MOCK_JOB_ID,],)# Verify paginator was called correctlyboto3_client_mock().get_paginator.assert_called_once_with("list_sessions")paginator_mock.paginate.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)# Verify get_job was called to get job nameboto3_client_mock().get_job.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)# Verify get_session_logs was called with the correct session IDmock_get_logs.assert_called_once_with(farm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,session_id="session-1",limit=100,start_time=None,end_time=None,next_token=None,config=ANY,)# Check output includes job informationassert "Using the only available session: session-1" in result.outputassert "Job ID: " + MOCK_JOB_ID in result.outputassert "Job Name: Test Job Name" in result.outputassert "Test log message" in result.outputassert result.exit_code == 0
1
57
1
324
3
422
498
422
fresh_deadline_config
['runner', 'result', 'paginator_mock']
None
{"Assign": 7, "Expr": 8, "With": 1}
20
77
20
["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "MagicMock", "boto3_client_mock", "boto3_client_mock", "api.SessionLogResult", "api.LogEvent", "datetime.datetime", "datetime.datetime", "CliRunner", "runner.invoke", "get_paginator.assert_called_once_with", "boto3_client_mock", "paginator_mock.paginate.assert_called_once_with", "get_job.assert_called_once_with", "boto3_client_mock", "mock_get_logs.assert_called_once_with"]
0
[]
The function (test_cli_job_logs_with_job_id_single_session) defined within the public class called public.The function start at line 422 and ends at 498. It contains 57 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 20.0 functions, and It has 20.0 functions called inside which are ["config.set_setting", "config.set_setting", "config.set_setting", "patch.object", "patch.object", "MagicMock", "boto3_client_mock", "boto3_client_mock", "api.SessionLogResult", "api.LogEvent", "datetime.datetime", "datetime.datetime", "CliRunner", "runner.invoke", "get_paginator.assert_called_once_with", "boto3_client_mock", "paginator_mock.paginate.assert_called_once_with", "get_job.assert_called_once_with", "boto3_client_mock", "mock_get_logs.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_with_job_id_no_sessions
def test_cli_job_logs_with_job_id_no_sessions(fresh_deadline_config):"""Test job logs command with job ID when there are no sessions."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock:# Mock the paginatorpaginator_mock = MagicMock()boto3_client_mock().get_paginator.return_value = paginator_mock# Set up the paginator to return no sessionspaginator_mock.paginate.return_value = [{"sessions": []}]runner = CliRunner()result = runner.invoke(main,["job","logs","--job-id",MOCK_JOB_ID,],)# Verify paginator was called correctlyboto3_client_mock().get_paginator.assert_called_once_with("list_sessions")paginator_mock.paginate.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)# Check error messageassert f"No sessions found for job {MOCK_JOB_ID}" in result.outputassert result.exit_code != 0
1
23
1
128
3
501
535
501
fresh_deadline_config
['runner', 'result', 'paginator_mock']
None
{"Assign": 5, "Expr": 5, "With": 1}
10
35
10
["config.set_setting", "config.set_setting", "patch.object", "MagicMock", "boto3_client_mock", "CliRunner", "runner.invoke", "get_paginator.assert_called_once_with", "boto3_client_mock", "paginator_mock.paginate.assert_called_once_with"]
0
[]
The function (test_cli_job_logs_with_job_id_no_sessions) defined within the public class called public.The function start at line 501 and ends at 535. It contains 23 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "MagicMock", "boto3_client_mock", "CliRunner", "runner.invoke", "get_paginator.assert_called_once_with", "boto3_client_mock", "paginator_mock.paginate.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_with_pagination
def test_cli_job_logs_with_pagination(fresh_deadline_config):"""Test job logs command with pagination of sessions."""config.set_setting("defaults.farm_id", MOCK_FARM_ID)config.set_setting("defaults.queue_id", MOCK_QUEUE_ID)with patch.object(api, "get_boto3_client") as boto3_client_mock, patch.object(api, "get_session_logs") as mock_get_logs:# Mock the paginatorpaginator_mock = MagicMock()boto3_client_mock().get_paginator.return_value = paginator_mock# Set up the paginator to return sessions across multiple pagespaginator_mock.paginate.return_value = [{"sessions": [{"sessionId": "session-1","endedAt": datetime.datetime(2023, 1, 27, 7, 0, 0),}]},{"sessions": [{"sessionId": "session-2","endedAt": datetime.datetime(2023, 1, 27, 8, 0, 0),}]},]# Mock the get_session_logs responsemock_get_logs.return_value = api.SessionLogResult(events=[api.LogEvent(timestamp=datetime.datetime(2023, 1, 27, 8, 0, 0),message="Test log message",ingestion_time=datetime.datetime(2023, 1, 27, 8, 0, 1),event_id="event-1",),],count=1,next_token=None,log_group=f"/aws/deadline/{MOCK_FARM_ID}/{MOCK_QUEUE_ID}",log_stream="session-2",)runner = CliRunner()result = runner.invoke(main,["job","logs","--job-id",MOCK_JOB_ID,],)# Verify paginator was called correctlyboto3_client_mock().get_paginator.assert_called_once_with("list_sessions")paginator_mock.paginate.assert_called_once_with(farmId=MOCK_FARM_ID, queueId=MOCK_QUEUE_ID, jobId=MOCK_JOB_ID)# Verify get_session_logs was called with the latest session IDmock_get_logs.assert_called_once_with(farm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,session_id="session-2",# Should use the latest sessionlimit=100,start_time=None,end_time=None,next_token=None,config=ANY,)# Check outputassert "Using the latest session: session-2" in result.outputassert "Test log message" in result.outputassert result.exit_code == 0
1
67
1
322
3
538
620
538
fresh_deadline_config
['runner', 'result', 'paginator_mock']
None
{"Assign": 6, "Expr": 6, "With": 1}
18
83
18
["config.set_setting", "config.set_setting", "patch.object", "patch.object", "MagicMock", "boto3_client_mock", "datetime.datetime", "datetime.datetime", "api.SessionLogResult", "api.LogEvent", "datetime.datetime", "datetime.datetime", "CliRunner", "runner.invoke", "get_paginator.assert_called_once_with", "boto3_client_mock", "paginator_mock.paginate.assert_called_once_with", "mock_get_logs.assert_called_once_with"]
0
[]
The function (test_cli_job_logs_with_pagination) defined within the public class called public.The function start at line 538 and ends at 620. It contains 67 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 18.0 functions, and It has 18.0 functions called inside which are ["config.set_setting", "config.set_setting", "patch.object", "patch.object", "MagicMock", "boto3_client_mock", "datetime.datetime", "datetime.datetime", "api.SessionLogResult", "api.LogEvent", "datetime.datetime", "datetime.datetime", "CliRunner", "runner.invoke", "get_paginator.assert_called_once_with", "boto3_client_mock", "paginator_mock.paginate.assert_called_once_with", "mock_get_logs.assert_called_once_with"].
aws-deadline_deadline-cloud
public
public
0
0
test_cli_job_logs_with_job_id_prioritizes_ongoing_sessions
def test_cli_job_logs_with_job_id_prioritizes_ongoing_sessions(fresh_deadline_config):"""Test that ongoing sessions (no endedAt) are prioritized over completed sessions."""with patch.object(config, "get_setting") as mock_get_setting:mock_get_setting.side_effect = [MOCK_FARM_ID,# _apply_cli_options_to_config check for farm_idMOCK_QUEUE_ID,# _apply_cli_options_to_config check for queue_idMOCK_FARM_ID,# defaults.farm_idMOCK_QUEUE_ID,# defaults.queue_idMOCK_JOB_ID,# defaults.job_id]with patch("deadline.client.api.get_boto3_client") as boto3_client_mock:with patch("deadline.client.api.get_session_logs") as mock_get_logs:# Set up the paginator to return mix of ongoing and completed sessionspaginator_mock = MagicMock()boto3_client_mock().get_paginator.return_value = paginator_mockpaginator_mock.paginate.return_value = [{"sessions": [{"sessionId": "session-completed-recent","startedAt": datetime.datetime(2023, 1, 27, 8, 0, 0),"endedAt": datetime.datetime(2023, 1, 27, 9, 0, 0),# Most recent completion},{"sessionId": "session-ongoing-older","startedAt": datetime.datetime(2023, 1, 27, 6, 0, 0),# Ongoing but older# No endedAt - this is ongoing},{"sessionId": "session-ongoing-newer","startedAt": datetime.datetime(2023, 1, 27, 7, 30, 0),# Ongoing and newer# No endedAt - this is ongoing},{"sessionId": "session-completed-older","startedAt": datetime.datetime(2023, 1, 27, 5, 0, 0),"endedAt": datetime.datetime(2023, 1, 27, 6, 0, 0),# Older completion},]}]# Mock the get_session_logs responsemock_get_logs.return_value = api.SessionLogResult(events=[api.LogEvent(timestamp=datetime.datetime(2023, 1, 27, 7, 30, 0),message="Ongoing session log message",ingestion_time=datetime.datetime(2023, 1, 27, 7, 30, 1),event_id="event-1",),],count=1,next_token=None,log_group=f"/aws/deadline/{MOCK_FARM_ID}/{MOCK_QUEUE_ID}",log_stream="session-ongoing-newer",)runner = CliRunner()result = runner.invoke(main,["job","logs","--job-id",MOCK_JOB_ID,],)# Verify get_session_logs was called with the most recently started ongoing sessionmock_get_logs.assert_called_once_with(farm_id=MOCK_FARM_ID,queue_id=MOCK_QUEUE_ID,session_id="session-ongoing-newer",# Should prioritize ongoing session with most recent startlimit=100,start_time=None,end_time=None,next_token=None,config=ANY,)# Check outputassert "Using the latest session: session-ongoing-newer" in result.outputassert "Ongoing session log message" in result.outputassert result.exit_code == 0
1
82
1
383
3
623
718
623
fresh_deadline_config
['runner', 'result', 'paginator_mock']
None
{"Assign": 7, "Expr": 2, "With": 3}
18
96
18
["patch.object", "patch", "patch", "MagicMock", "boto3_client_mock", "datetime.datetime", "datetime.datetime", "datetime.datetime", "datetime.datetime", "datetime.datetime", "datetime.datetime", "api.SessionLogResult", "api.LogEvent", "datetime.datetime", "datetime.datetime", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once_with"]
0
[]
The function (test_cli_job_logs_with_job_id_prioritizes_ongoing_sessions) defined within the public class called public.The function start at line 623 and ends at 718. It contains 82 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 18.0 functions, and It has 18.0 functions called inside which are ["patch.object", "patch", "patch", "MagicMock", "boto3_client_mock", "datetime.datetime", "datetime.datetime", "datetime.datetime", "datetime.datetime", "datetime.datetime", "datetime.datetime", "api.SessionLogResult", "api.LogEvent", "datetime.datetime", "datetime.datetime", "CliRunner", "runner.invoke", "mock_get_logs.assert_called_once_with"].