<s> import sys <EOL> import os <EOL> import unittest <EOL> sys . path . append ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) ) <EOL> from testlib import get_fixture , random_string , function <EOL> from testlib import EapiConfigUnitTest <EOL> import pyeapi . api . system <EOL> class TestApiSystem ( EapiConfigUnitTest ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( TestApiSystem , self ) . __init__ ( * args , ** kwargs ) <EOL> self . instance = pyeapi . api . system . instance ( None ) <EOL> self . config = open ( get_fixture ( '<STR_LIT>' ) ) . read ( ) <EOL> def test_get ( self ) : <EOL> keys = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> result = self . instance . get ( ) <EOL> self . assertEqual ( sorted ( keys ) , sorted ( list ( result . keys ( ) ) ) ) <EOL> self . assertIsNotNone ( self . instance . get ( ) [ '<STR_LIT>' ] ) <EOL> self . assertIsNotNone ( self . instance . get ( ) [ '<STR_LIT>' ] ) <EOL> def test_set_hostname ( self ) : <EOL> for state in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:default>' ] : <EOL> value = random_string ( ) <EOL> if state == '<STR_LIT>' : <EOL> cmds = '<STR_LIT>' % value <EOL> func = function ( '<STR_LIT>' , value ) <EOL> elif state == '<STR_LIT>' : <EOL> cmds = '<STR_LIT>' <EOL> func = function ( '<STR_LIT>' , disable = True ) <EOL> elif state == '<STR_LIT:default>' : <EOL> cmds = '<STR_LIT>' <EOL> func = function ( '<STR_LIT>' , value = value , default = True ) <EOL> self . eapi_positive_config_test ( func , cmds ) <EOL> def test_set_iprouting ( self ) : <EOL> for state in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:default>' ] : <EOL> if state == '<STR_LIT>' : <EOL> cmds = '<STR_LIT>' <EOL> func = function ( '<STR_LIT>' , True ) <EOL> elif state == '<STR_LIT>' : <EOL> cmds = '<STR_LIT>' <EOL> func = function ( '<STR_LIT>' , disable = True ) <EOL> elif state == '<STR_LIT:default>' : <EOL> cmds = '<STR_LIT>' <EOL> func = function ( '<STR_LIT>' , default = True ) <EOL> self . eapi_positive_config_test ( func , cmds ) <EOL> def test_set_banner ( self ) : <EOL> banner_value = random_string ( ) + "<STR_LIT:\n>" <EOL> func = function ( '<STR_LIT>' , banner_type = '<STR_LIT>' , <EOL> value = banner_value ) <EOL> cmds = [ dict ( cmd = '<STR_LIT>' , input = banner_value ) ] <EOL> self . eapi_positive_config_test ( func , cmds ) <EOL> def test_set_banner_default_disable ( self ) : <EOL> func = function ( '<STR_LIT>' , banner_type = '<STR_LIT>' , <EOL> value = None , default = True ) <EOL> cmds = '<STR_LIT>' <EOL> self . eapi_positive_config_test ( func , cmds ) <EOL> func = function ( '<STR_LIT>' , banner_type = '<STR_LIT>' , <EOL> value = None , disable = True ) <EOL> cmds = '<STR_LIT>' <EOL> self . eapi_positive_config_test ( func , cmds ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
