<s> from __future__ import absolute_import <EOL> from salttesting import skipIf , TestCase <EOL> from salttesting . helpers import ensure_in_syspath <EOL> from salttesting . mock import ( <EOL> MagicMock , <EOL> patch , <EOL> NO_MOCK , <EOL> NO_MOCK_REASON <EOL> ) <EOL> ensure_in_syspath ( '<STR_LIT>' ) <EOL> from salt . utils . odict import OrderedDict <EOL> from salt . modules import pillar as pillarmod <EOL> pillar_value_1 = dict ( a = <NUM_LIT:1> , b = '<STR_LIT>' ) <EOL> class PillarModuleTestCase ( TestCase ) : <EOL> def test_obfuscate_inner_recursion ( self ) : <EOL> self . assertEqual ( <EOL> pillarmod . _obfuscate_inner ( dict ( a = [ <NUM_LIT:1> , <NUM_LIT:2> ] , <EOL> b = dict ( pwd = '<STR_LIT>' , deeper = ( '<STR_LIT:a>' , <NUM_LIT:1> ) ) ) ) , <EOL> dict ( a = [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> b = dict ( pwd = '<STR_LIT>' , deeper = ( '<STR_LIT>' , '<STR_LIT>' ) ) ) <EOL> ) <EOL> def test_obfuscate_inner_more_types ( self ) : <EOL> self . assertEqual ( pillarmod . _obfuscate_inner ( OrderedDict ( [ ( '<STR_LIT:key>' , '<STR_LIT:value>' ) ] ) ) , <EOL> OrderedDict ( [ ( '<STR_LIT:key>' , '<STR_LIT>' ) ] ) ) <EOL> self . assertEqual ( pillarmod . _obfuscate_inner ( set ( ( <NUM_LIT:1> , <NUM_LIT:2> ) ) ) , <EOL> set ( [ '<STR_LIT>' ] ) ) <EOL> self . assertEqual ( pillarmod . _obfuscate_inner ( ( <NUM_LIT:1> , <NUM_LIT:2> ) ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> @ patch ( '<STR_LIT>' , MagicMock ( return_value = pillar_value_1 ) ) <EOL> def test_obfuscate ( self ) : <EOL> self . assertEqual ( pillarmod . obfuscate ( ) , <EOL> dict ( a = '<STR_LIT>' , b = '<STR_LIT>' ) ) <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> @ patch ( '<STR_LIT>' , MagicMock ( return_value = pillar_value_1 ) ) <EOL> def test_ls ( self ) : <EOL> self . assertEqual ( pillarmod . ls ( ) , [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( PillarModuleTestCase , needs_daemon = False ) </s>
