<s> import yaml <EOL> from st2tests . base import BaseActionTestCase <EOL> from check_auto_deploy_repo import CheckAutoDeployRepo <EOL> __all__ = [ <EOL> '<STR_LIT>' <EOL> ] <EOL> MOCK_DATA_1 = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } <EOL> MOCK_CONFIG_BLANK = "<STR_LIT>" <EOL> MOCK_CONFIG_BLANK_REPOSITORIES = "<STR_LIT>" <EOL> MOCK_CONFIG_FULL = """<STR_LIT>""" <EOL> class CheckAutoDeployRepoActionTestCase ( BaseActionTestCase ) : <EOL> action_cls = CheckAutoDeployRepo <EOL> def test_run_config_blank ( self ) : <EOL> config = yaml . safe_load ( MOCK_CONFIG_BLANK ) <EOL> action = self . get_action_instance ( config = config ) <EOL> self . assertRaises ( Exception , action . run , <EOL> branch = "<STR_LIT>" , repo_name = "<STR_LIT>" ) <EOL> def test_run_repositories_blank ( self ) : <EOL> config = yaml . safe_load ( MOCK_CONFIG_BLANK_REPOSITORIES ) <EOL> action = self . get_action_instance ( config = config ) <EOL> self . assertRaises ( Exception , action . run , <EOL> branch = "<STR_LIT>" , repo_name = "<STR_LIT>" ) <EOL> def test_run_st2contrib_no_auto_deloy ( self ) : <EOL> config = yaml . safe_load ( MOCK_CONFIG_FULL ) <EOL> action = self . get_action_instance ( config = config ) <EOL> self . assertRaises ( Exception , action . run , <EOL> branch = "<STR_LIT>" , repo_name = "<STR_LIT>" ) <EOL> def test_run_st2contrib_auto_deloy ( self ) : <EOL> config = yaml . safe_load ( MOCK_CONFIG_FULL ) <EOL> action = self . get_action_instance ( config = config ) <EOL> expected = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> result = action . run ( branch = "<STR_LIT>" , repo_name = "<STR_LIT>" ) <EOL> self . assertEqual ( result , expected ) <EOL> def test_run_st2incubator_no_auto_deloy ( self ) : <EOL> config = yaml . safe_load ( MOCK_CONFIG_FULL ) <EOL> action = CheckAutoDeployRepo ( config ) <EOL> self . assertRaises ( Exception , action . run , <EOL> branch = "<STR_LIT>" , repo_name = "<STR_LIT>" ) <EOL> def test_run_st2incubator_auto_deloy ( self ) : <EOL> config = yaml . safe_load ( MOCK_CONFIG_FULL ) <EOL> action = self . get_action_instance ( config = config ) <EOL> expected = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> result = action . run ( branch = "<STR_LIT>" , repo_name = "<STR_LIT>" ) <EOL> self . assertEqual ( result , expected ) </s>
