<s> import uuid <EOL> from gnocchiclient . tests . functional import base <EOL> class ArchivePolicyRuleClientTest ( base . ClientTestBase ) : <EOL> def test_archive_policy_rule_scenario ( self ) : <EOL> apname = str ( uuid . uuid4 ( ) ) <EOL> self . gnocchi ( <EOL> u'<STR_LIT>' , params = u"<STR_LIT>" <EOL> u"<STR_LIT>" % apname ) <EOL> result = self . gnocchi ( <EOL> u'<STR_LIT>' , params = u"<STR_LIT>" <EOL> u"<STR_LIT>" <EOL> u"<STR_LIT>" % apname ) <EOL> policy_rule = self . details_multiple ( result ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( '<STR_LIT:test>' , policy_rule [ "<STR_LIT:name>" ] ) <EOL> result = self . gnocchi ( <EOL> u'<STR_LIT>' , params = u"<STR_LIT>" <EOL> u"<STR_LIT>" <EOL> u"<STR_LIT>" , <EOL> fail_ok = True , merge_stderr = True ) <EOL> self . assertFirstLineStartsWith ( <EOL> result . split ( '<STR_LIT:\n>' ) , <EOL> "<STR_LIT>" ) <EOL> result = self . gnocchi ( <EOL> '<STR_LIT>' , params = "<STR_LIT>" ) <EOL> policy_rule = self . details_multiple ( result ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( "<STR_LIT:test>" , policy_rule [ "<STR_LIT:name>" ] ) <EOL> result = self . gnocchi ( '<STR_LIT>' , params = "<STR_LIT:list>" ) <EOL> rules = self . parser . listing ( result ) <EOL> rule_from_list = [ p for p in rules <EOL> if p [ '<STR_LIT:name>' ] == '<STR_LIT:test>' ] [ <NUM_LIT:0> ] <EOL> for field in [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> self . assertEqual ( policy_rule [ field ] , rule_from_list [ field ] ) <EOL> result = self . gnocchi ( '<STR_LIT>' , <EOL> params = "<STR_LIT>" ) <EOL> self . assertEqual ( "<STR_LIT>" , result ) <EOL> result = self . gnocchi ( '<STR_LIT>' , <EOL> params = "<STR_LIT>" , <EOL> fail_ok = True , merge_stderr = True ) <EOL> self . assertFirstLineStartsWith ( <EOL> result . split ( '<STR_LIT:\n>' ) , <EOL> "<STR_LIT>" ) <EOL> result = self . gnocchi ( '<STR_LIT>' , <EOL> params = "<STR_LIT>" , <EOL> fail_ok = True , merge_stderr = True ) <EOL> self . assertFirstLineStartsWith ( <EOL> result . split ( '<STR_LIT:\n>' ) , <EOL> "<STR_LIT>" ) </s>
