Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbr70 committed Oct 6, 2017
1 parent 551c852 commit b05cec3
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions sandbox_scripts/environment/setup/tests/test_setup_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ def test_flow_ok_with_snapshots(self, mock_save, mock_sandboxbase, mock_api_sess

mock_save.return_value.is_snapshot.return_value = True
self.setup_script.execute()
mock_sandboxbase.return_value.clear_all_resources_live_status.assert_called_with()
mock_save.return_value.load_config.assert_called_with(config_stage='Snapshots', config_type='Running', ignore_models=['Generic TFTP server', 'Config Set Pool', 'Generic FTP server', 'netscout switch 3912', 'Subnet-28', 'Subnet-30', 'GitLab'])
mock_sandboxbase.return_value.clear_all_resources_live_status.assert_called_with(['Generic TFTP server', 'Config Set Pool', 'Generic FTP server', 'netscout switch 3912', 'Subnet-28', 'Subnet-30', 'GitLab', 'SSID_Pool'])
mock_save.return_value.load_config.assert_called_with(config_stage='Snapshots', config_type='Running', ignore_models=['Generic TFTP server', 'Config Set Pool', 'Generic FTP server', 'netscout switch 3912', 'Subnet-28', 'Subnet-30', 'GitLab', 'SSID_Pool'])
mock_sandboxbase.return_value.power_on_vms.assert_called_with()
mock_sandboxbase.return_value.activate_all_routes_and_connectors.assert_called_with()
report_info_calls = [call('Beginning load configuration for resources'),
call('Sandbox setup finished successfully')]
call('Clearing status indicators ', write_to_output_window=True),
call('Sandbox setup finished.', write_to_output_window=True)]
mock_sandboxbase.return_value.report_info.assert_has_calls(report_info_calls)


Expand All @@ -55,12 +56,15 @@ def test_flow_ok_with_gold(self, mock_save, mock_sandboxbase, mock_api_session):
mock_save.return_value.is_snapshot.return_value = False
mock_sandboxbase.return_value.get_storage_server_resource.return_value = True
self.setup_script.execute()
mock_sandboxbase.return_value.clear_all_resources_live_status.assert_called_with()
mock_save.return_value.load_config.assert_called_with(config_set_name='', config_stage='Gold', config_type='Running', ignore_models=['Generic TFTP server', 'Config Set Pool', 'Generic FTP server', 'netscout switch 3912', 'Subnet-28', 'Subnet-30', 'GitLab'])
mock_sandboxbase.return_value.clear_all_resources_live_status.assert_called_with(
['Generic TFTP server', 'Config Set Pool', 'Generic FTP server', 'netscout switch 3912', 'Subnet-28',
'Subnet-30', 'GitLab', 'SSID_Pool'])
mock_save.return_value.load_config.assert_called_with(config_set_name='', config_stage='Gold', config_type='Running', ignore_models=['Generic TFTP server', 'Config Set Pool', 'Generic FTP server', 'netscout switch 3912', 'Subnet-28', 'Subnet-30', 'GitLab', 'SSID_Pool'])
mock_sandboxbase.return_value.power_on_vms.assert_called_with()
mock_sandboxbase.return_value.activate_all_routes_and_connectors.assert_called_with()
report_info_calls = [call('Beginning load configuration for resources'),
call('Sandbox setup finished successfully')]
call('Clearing status indicators ', write_to_output_window=True),
call('Sandbox setup finished.', write_to_output_window=True)]
mock_sandboxbase.return_value.report_info.assert_has_calls(report_info_calls)

@patch('cloudshell.helpers.scripts.cloudshell_scripts_helpers.get_api_session')
Expand All @@ -69,10 +73,13 @@ def test_flow_ok_with_gold(self, mock_save, mock_sandboxbase, mock_api_session):
def test_flow_ok_with_no_storage_device(self, mock_save, mock_sandboxbase, mock_api_session):
mock_sandboxbase.return_value.get_storage_server_resource.return_value = False
self.setup_script.execute()
mock_sandboxbase.return_value.clear_all_resources_live_status.assert_called_with()
mock_sandboxbase.return_value.clear_all_resources_live_status.assert_called_with(
['Generic TFTP server', 'Config Set Pool', 'Generic FTP server', 'netscout switch 3912', 'Subnet-28',
'Subnet-30', 'GitLab', 'SSID_Pool'])
report_info_calls = [call('Beginning load configuration for resources'),
call('Clearing status indicators ', write_to_output_window=True),
call('Skipping load configuration. No storage resource associated with the blueprint ', write_to_output_window=True),
call('Sandbox setup finished successfully')]
call('Sandbox setup finished.', write_to_output_window=True)]
mock_sandboxbase.return_value.report_info.assert_has_calls(report_info_calls)

@patch('cloudshell.helpers.scripts.cloudshell_scripts_helpers.get_api_session')
Expand All @@ -84,6 +91,7 @@ def test_qualierror_exception(self, mock_save, mock_sandboxbase, mock_api_sessio

self.setup_script.execute()
report_info_calls = [call('Beginning load configuration for resources'),
call('Clearing status indicators ', write_to_output_window=True),
call('Skipping load configuration. No storage resource associated with the blueprint ',
write_to_output_window=True)]
mock_sandboxbase.return_value.report_info.assert_has_calls(report_info_calls)
Expand Down

0 comments on commit b05cec3

Please sign in to comment.