<s> import json <EOL> import re <EOL> import unittest <EOL> from tests . functional import utils <EOL> class DeploymentTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( DeploymentTestCase , self ) . setUp ( ) <EOL> self . rally = utils . Rally ( ) <EOL> def test_create_fromenv_list_show ( self ) : <EOL> self . rally . env . update ( utils . TEST_ENV ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , self . rally ( "<STR_LIT>" ) ) <EOL> self . assertIn ( utils . TEST_ENV [ "<STR_LIT>" ] , <EOL> self . rally ( "<STR_LIT>" ) ) <EOL> def test_create_fromfile ( self ) : <EOL> self . rally . env . update ( utils . TEST_ENV ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> with open ( "<STR_LIT>" , "<STR_LIT:w>" ) as f : <EOL> f . write ( self . rally ( "<STR_LIT>" ) ) <EOL> self . rally ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , self . rally ( "<STR_LIT>" ) ) <EOL> def test_config ( self ) : <EOL> self . rally . env . update ( utils . TEST_ENV ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> config = json . loads ( self . rally ( "<STR_LIT>" ) ) <EOL> self . assertEqual ( utils . TEST_ENV [ "<STR_LIT>" ] , <EOL> config [ "<STR_LIT>" ] [ "<STR_LIT:username>" ] ) <EOL> self . assertEqual ( utils . TEST_ENV [ "<STR_LIT>" ] , <EOL> config [ "<STR_LIT>" ] [ "<STR_LIT:password>" ] ) <EOL> self . assertEqual ( utils . TEST_ENV [ "<STR_LIT>" ] , <EOL> config [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( utils . TEST_ENV [ "<STR_LIT>" ] , <EOL> config [ "<STR_LIT>" ] ) <EOL> def test_destroy ( self ) : <EOL> self . rally . env . update ( utils . TEST_ENV ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , self . rally ( "<STR_LIT>" ) ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> self . assertNotIn ( "<STR_LIT>" , self . rally ( "<STR_LIT>" ) ) <EOL> def test_check_success ( self ) : <EOL> self . assertTrue ( self . rally ( "<STR_LIT>" ) ) <EOL> def test_check_fail ( self ) : <EOL> self . rally . env . update ( utils . TEST_ENV ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> self . assertRaises ( utils . RallyCliError , self . rally , <EOL> ( "<STR_LIT>" ) ) <EOL> def test_recreate ( self ) : <EOL> self . rally . env . update ( utils . TEST_ENV ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> self . assertIn ( "<STR_LIT>" , self . rally ( "<STR_LIT>" ) ) <EOL> def test_use ( self ) : <EOL> self . rally . env . update ( utils . TEST_ENV ) <EOL> output = self . rally ( <EOL> "<STR_LIT>" ) <EOL> uuid = re . search ( r"<STR_LIT>" , <EOL> output ) . group ( "<STR_LIT>" ) <EOL> self . rally ( "<STR_LIT>" ) <EOL> self . rally ( "<STR_LIT>" % uuid ) <EOL> current_deployment = utils . get_global ( "<STR_LIT>" , <EOL> self . rally . env ) <EOL> self . assertEqual ( uuid , current_deployment ) </s>
