<s> import base64 <EOL> import os <EOL> import sys <EOL> import unittest <EOL> import yaml <EOL> import boto <EOL> from flexmock import flexmock <EOL> lib = os . path . dirname ( __file__ ) + os . sep + "<STR_LIT:..>" + os . sep + "<STR_LIT>" <EOL> sys . path . append ( lib ) <EOL> from agents . base_agent import AgentConfigurationException <EOL> from agents . ec2_agent import EC2Agent <EOL> from agents . euca_agent import EucalyptusAgent <EOL> from appscale_logger import AppScaleLogger <EOL> from custom_exceptions import BadConfigurationException <EOL> from parse_args import ParseArgs <EOL> class TestParseArgs ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . cloud_argv = [ '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> self . cluster_argv = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . function = "<STR_LIT>" <EOL> flexmock ( AppScaleLogger ) <EOL> AppScaleLogger . should_receive ( '<STR_LIT>' ) . and_return ( ) <EOL> for credential in EucalyptusAgent . REQUIRED_EC2_CREDENTIALS : <EOL> os . environ [ credential ] = "<STR_LIT>" <EOL> os . environ [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> fake_ec2 = flexmock ( name = "<STR_LIT>" ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_return ( ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_return ( '<STR_LIT>' ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( [ '<STR_LIT>' ] ) . and_return ( '<STR_LIT>' ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_return ( '<STR_LIT>' ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_raise ( boto . exception . EC2ResponseError , '<STR_LIT>' , '<STR_LIT>' ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_return ( '<STR_LIT>' ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_raise ( boto . exception . EC2ResponseError , '<STR_LIT>' , '<STR_LIT>' ) <EOL> fake_price = flexmock ( name = '<STR_LIT>' , price = <NUM_LIT> ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . and_return ( [ fake_price ] ) <EOL> flexmock ( boto ) <EOL> flexmock ( boto . ec2 ) <EOL> boto . ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , <EOL> aws_access_key_id = '<STR_LIT>' , aws_secret_access_key = '<STR_LIT>' ) . and_return ( fake_ec2 ) <EOL> boto . ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' , <EOL> aws_access_key_id = '<STR_LIT>' , aws_secret_access_key = '<STR_LIT>' ) . and_return ( fake_ec2 ) <EOL> boto . should_receive ( '<STR_LIT>' ) . and_return ( fake_ec2 ) <EOL> def tearDown ( self ) : <EOL> for credential in EucalyptusAgent . REQUIRED_EC2_CREDENTIALS : <EOL> os . environ [ credential ] = '<STR_LIT>' <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> def test_flags_that_cause_program_abort ( self ) : <EOL> argv_1 = [ '<STR_LIT>' ] <EOL> self . assertRaises ( SystemExit , ParseArgs , argv_1 , <EOL> self . function ) <EOL> argv_2 = [ '<STR_LIT>' ] <EOL> try : <EOL> ParseArgs ( argv_2 , self . function ) <EOL> raise <EOL> except SystemExit : <EOL> pass <EOL> def test_get_min_and_max ( self ) : <EOL> argv_1 = [ '<STR_LIT>' , '<STR_LIT:0>' , '<STR_LIT>' , '<STR_LIT:1>' ] <EOL> self . assertRaises ( BadConfigurationException , <EOL> ParseArgs , argv_1 , self . function ) <EOL> argv_2 = [ '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT:0>' ] <EOL> self . assertRaises ( BadConfigurationException , <EOL> ParseArgs , argv_2 , self . function ) <EOL> argv_3 = [ '<STR_LIT>' , '<STR_LIT:1>' ] <EOL> actual_3 = ParseArgs ( argv_3 , self . function ) <EOL> self . assertEquals ( actual_3 . args . min , actual_3 . args . max ) <EOL> argv_4 = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:1>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv_4 , <EOL> self . function ) <EOL> def test_table_flags ( self ) : <EOL> flexmock ( os . path ) <EOL> os . path . should_call ( '<STR_LIT>' ) <EOL> os . path . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_return ( True ) <EOL> argv_1 = self . cluster_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertRaises ( SystemExit , ParseArgs , argv_1 , self . function ) <EOL> argv_2 = self . cluster_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> actual_2 = ParseArgs ( argv_2 , self . function ) <EOL> self . assertEquals ( '<STR_LIT>' , actual_2 . args . table ) <EOL> args_3 = self . cluster_argv [ : ] <EOL> actual_3 = ParseArgs ( args_3 , self . function ) <EOL> self . assertEquals ( ParseArgs . DEFAULT_DATASTORE , actual_3 . args . table ) <EOL> argv_4 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:0>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv_4 , <EOL> self . function ) <EOL> argv_5 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:2>' ] <EOL> actual_5 = ParseArgs ( argv_5 , self . function ) <EOL> self . assertEquals ( <NUM_LIT:2> , actual_5 . args . replication ) <EOL> def test_gather_logs_flags ( self ) : <EOL> argv = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> actual = ParseArgs ( argv , "<STR_LIT>" ) <EOL> self . assertEquals ( "<STR_LIT>" , actual . args . location ) <EOL> def test_developer_flags ( self ) : <EOL> argv_1 = self . cloud_argv [ : ] + [ '<STR_LIT>' ] <EOL> actual_1 = ParseArgs ( argv_1 , self . function ) <EOL> self . assertEquals ( True , actual_1 . args . force ) <EOL> argv_2 = self . cloud_argv [ : ] + [ '<STR_LIT>' ] <EOL> actual_2 = ParseArgs ( argv_2 , self . function ) <EOL> self . assertEquals ( True , actual_2 . args . test ) <EOL> def test_infrastructure_flags ( self ) : <EOL> argv_1 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> actual_1 = ParseArgs ( argv_1 , self . function ) <EOL> self . assertEquals ( '<STR_LIT>' , actual_1 . args . infrastructure ) <EOL> argv_2 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> actual_2 = ParseArgs ( argv_2 , self . function ) <EOL> self . assertEquals ( '<STR_LIT>' , actual_2 . args . infrastructure ) <EOL> argv_3 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> self . assertRaises ( SystemExit , ParseArgs , argv_3 , self . function ) <EOL> flexmock ( os . path ) <EOL> os . path . should_call ( '<STR_LIT>' ) <EOL> os . path . should_receive ( '<STR_LIT>' ) . with_args ( "<STR_LIT>" ) . and_return ( True ) <EOL> argv_4 = self . cluster_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv_4 , <EOL> self . function ) <EOL> def test_instance_types ( self ) : <EOL> argv_1 = self . cloud_argv [ : ] <EOL> actual = ParseArgs ( argv_1 , self . function ) <EOL> self . assertEquals ( ParseArgs . DEFAULT_EC2_INSTANCE_TYPE , actual . args . instance_type ) <EOL> argv_2 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> actual = ParseArgs ( argv_2 , self . function ) <EOL> self . assertEquals ( "<STR_LIT>" , actual . args . instance_type ) <EOL> argv_3 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertRaises ( SystemExit , ParseArgs , argv_3 , self . function ) <EOL> def test_machine_not_set_in_cloud_deployments ( self ) : <EOL> argv = [ '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT:1>' , "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , <EOL> "<STR_LIT>" ) <EOL> def test_scaling_flags ( self ) : <EOL> argv_1 = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( SystemExit , ParseArgs , argv_1 , <EOL> "<STR_LIT>" ) <EOL> argv_2 = [ "<STR_LIT>" ] <EOL> actual = ParseArgs ( argv_2 , "<STR_LIT>" ) <EOL> self . assertEquals ( True , actual . args . add_to_existing ) <EOL> def test_environment_variables_not_set_in_ec2_cloud_deployments ( self ) : <EOL> argv = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> for var in EC2Agent . REQUIRED_EC2_CREDENTIALS : <EOL> os . environ [ var ] = '<STR_LIT>' <EOL> self . assertRaises ( AgentConfigurationException , ParseArgs , argv , <EOL> self . function ) <EOL> def test_environment_variables_not_set_in_euca_cloud_deployments ( self ) : <EOL> argv = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> for var in EucalyptusAgent . REQUIRED_EUCA_CREDENTIALS : <EOL> os . environ [ var ] = '<STR_LIT>' <EOL> self . assertRaises ( AgentConfigurationException , ParseArgs , argv , <EOL> self . function ) <EOL> def test_failure_when_ami_doesnt_exist ( self ) : <EOL> fake_ec2 = flexmock ( name = "<STR_LIT>" ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) <EOL> fake_ec2 . should_receive ( '<STR_LIT>' ) . with_args ( '<STR_LIT>' ) . and_raise ( boto . exception . EC2ResponseError , '<STR_LIT>' , '<STR_LIT>' ) <EOL> flexmock ( boto . ec2 ) <EOL> boto . ec2 . should_receive ( '<STR_LIT>' ) . with_args ( str , <EOL> aws_access_key_id = '<STR_LIT>' , aws_secret_access_key = '<STR_LIT>' ) . and_return ( fake_ec2 ) <EOL> argv = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , self . function ) <EOL> def test_failure_when_user_doesnt_specify_ips_or_machine ( self ) : <EOL> argv = [ '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , self . function ) <EOL> def test_ips_layout_flag ( self ) : <EOL> ips_layout = yaml . load ( """<STR_LIT>""" ) <EOL> base64ed_ips = base64 . b64encode ( yaml . dump ( ips_layout ) ) <EOL> argv = [ '<STR_LIT>' , base64ed_ips ] <EOL> actual = ParseArgs ( argv , self . function ) . args <EOL> self . assertEquals ( base64ed_ips , actual . ips_layout ) <EOL> self . assertEquals ( ips_layout , actual . ips ) <EOL> def test_scp_flag ( self ) : <EOL> argv_1 = self . cloud_argv [ : ] + [ '<STR_LIT>' ] <EOL> self . assertRaises ( SystemExit , ParseArgs , argv_1 , self . function ) <EOL> argv_2 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> actual = ParseArgs ( argv_2 , self . function ) . args <EOL> self . assertEquals ( '<STR_LIT>' , actual . scp ) <EOL> def test_login_flag ( self ) : <EOL> argv_1 = self . cloud_argv [ : ] + [ '<STR_LIT>' ] <EOL> self . assertRaises ( SystemExit , ParseArgs , argv_1 , self . function ) <EOL> argv_2 = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> actual = ParseArgs ( argv_2 , self . function ) . args <EOL> self . assertEquals ( '<STR_LIT>' , actual . login_host ) <EOL> def test_spot_instances_flag ( self ) : <EOL> euca_argv = [ '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , euca_argv , <EOL> self . function ) <EOL> cluster_argv = self . cluster_argv [ : ] + [ '<STR_LIT>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , cluster_argv , <EOL> self . function ) <EOL> ec2_argv = self . cloud_argv [ : ] + [ '<STR_LIT>' ] <EOL> actual = ParseArgs ( ec2_argv , self . function ) . args <EOL> self . assertEquals ( True , actual . use_spot_instances ) <EOL> def test_max_spot_instance_price_flag ( self ) : <EOL> euca_argv = [ '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT:1>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , euca_argv , <EOL> self . function ) <EOL> cluster_argv = self . cluster_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , cluster_argv , <EOL> self . function ) <EOL> ec2_bad_argv = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , ec2_bad_argv , <EOL> self . function ) <EOL> ec2_argv = self . cloud_argv [ : ] + [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> actual = ParseArgs ( ec2_argv , self . function ) . args <EOL> self . assertEquals ( True , actual . use_spot_instances ) <EOL> self . assertEquals ( <NUM_LIT> , actual . max_spot_price ) <EOL> def test_ec2_creds_in_run_instances ( self ) : <EOL> argv = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , self . function ) <EOL> argv = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , self . function ) <EOL> argv = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> ParseArgs ( argv , self . function ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> argv = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> ParseArgs ( argv , self . function ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> def test_ec2_creds_in_term_instances ( self ) : <EOL> function = "<STR_LIT>" <EOL> argv = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , function ) <EOL> argv = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , function ) <EOL> argv = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> ParseArgs ( argv , function ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> argv = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> ParseArgs ( argv , function ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> def test_disks_flag ( self ) : <EOL> argv = self . cluster_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , self . function ) <EOL> bad_disks_layout = yaml . load ( """<STR_LIT>""" ) <EOL> base64ed_bad_disks = base64 . b64encode ( yaml . dump ( bad_disks_layout ) ) <EOL> cloud_argv1 = self . cloud_argv [ : ] + [ "<STR_LIT>" , base64ed_bad_disks ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , cloud_argv1 , <EOL> self . function ) <EOL> disks = { '<STR_LIT>' : '<STR_LIT>' } <EOL> good_disks_layout = yaml . load ( """<STR_LIT>""" ) <EOL> base64ed_good_disks = base64 . b64encode ( yaml . dump ( good_disks_layout ) ) <EOL> cloud_argv2 = self . cloud_argv [ : ] + [ "<STR_LIT>" , base64ed_good_disks ] <EOL> actual = ParseArgs ( cloud_argv2 , self . function ) . args <EOL> self . assertEquals ( disks , actual . disks ) <EOL> def test_zone_flag ( self ) : <EOL> argv = self . cluster_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , self . function ) <EOL> cloud_argv1 = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , cloud_argv1 , <EOL> self . function ) <EOL> cloud_argv2 = self . cloud_argv [ : ] <EOL> actual = ParseArgs ( cloud_argv2 , self . function ) . args <EOL> self . assertEquals ( '<STR_LIT>' , actual . zone ) <EOL> def test_static_ip_flag ( self ) : <EOL> argv = self . cluster_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , argv , self . function ) <EOL> cloud_argv1 = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . assertRaises ( BadConfigurationException , ParseArgs , cloud_argv1 , <EOL> self . function ) <EOL> cloud_argv2 = self . cloud_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> actual = ParseArgs ( cloud_argv2 , self . function ) . args <EOL> self . assertEquals ( '<STR_LIT>' , actual . static_ip ) <EOL> def test_no_password_for_flower_results_in_default ( self ) : <EOL> argv = self . cluster_argv [ : ] <EOL> actual = ParseArgs ( argv , self . function ) . args <EOL> self . assertEquals ( ParseArgs . DEFAULT_FLOWER_PASSWORD , actual . flower_password ) <EOL> def test_password_for_flower_gets_passed_through ( self ) : <EOL> password = "<STR_LIT>" <EOL> argv = self . cluster_argv [ : ] + [ "<STR_LIT>" , password ] <EOL> actual = ParseArgs ( argv , self . function ) . args <EOL> self . assertEquals ( password , actual . flower_password ) <EOL> def test_no_max_memory_flag_gets_set_to_default ( self ) : <EOL> argv = self . cluster_argv [ : ] <EOL> actual = ParseArgs ( argv , self . function ) . args <EOL> self . assertEquals ( ParseArgs . DEFAULT_MAX_MEMORY , actual . max_memory ) <EOL> def test_max_memory_flag_gets_passed_through ( self ) : <EOL> argv = self . cluster_argv [ : ] + [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> actual = ParseArgs ( argv , self . function ) . args <EOL> self . assertEquals ( <NUM_LIT> , actual . max_memory ) </s>
