<s> """<STR_LIT>""" <EOL> import re <EOL> from cStringIO import StringIO <EOL> import agent_test <EOL> import commands . redhat . network <EOL> import commands . debian . network <EOL> import commands . arch . network <EOL> import commands . gentoo . network <EOL> import commands . suse . network <EOL> class TestHostNameUpdates ( agent_test . TestCase ) : <EOL> def _run_test ( self , dist , hostname , infile = None ) : <EOL> mod = getattr ( commands , dist ) . network <EOL> if infile : <EOL> return mod . get_hostname_file ( infile , hostname ) <EOL> else : <EOL> return mod . get_hostname_file ( hostname ) <EOL> def test_redhat_add_entry ( self ) : <EOL> """<STR_LIT>""" <EOL> infile = StringIO ( '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> data = self . _run_test ( '<STR_LIT>' , '<STR_LIT>' , infile ) <EOL> self . assertEqual ( data , '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> def test_redhat_update_entry ( self ) : <EOL> """<STR_LIT>""" <EOL> infile = StringIO ( '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> data = self . _run_test ( '<STR_LIT>' , '<STR_LIT>' , infile ) <EOL> self . assertEqual ( data , '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> def test_debian ( self ) : <EOL> """<STR_LIT>""" <EOL> data = self . _run_test ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( data , '<STR_LIT>' ) <EOL> def test_arch_add_entry ( self ) : <EOL> """<STR_LIT>""" <EOL> infile = StringIO ( '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> data = self . _run_test ( '<STR_LIT>' , '<STR_LIT>' , infile ) <EOL> self . assertEqual ( data , <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> def test_arch_update_entry ( self ) : <EOL> """<STR_LIT>""" <EOL> infile = StringIO ( '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> data = self . _run_test ( '<STR_LIT>' , '<STR_LIT>' , infile ) <EOL> self . assertEqual ( data , <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> def test_gentoo ( self ) : <EOL> """<STR_LIT>""" <EOL> data = self . _run_test ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> regex_hostname = re . compile ( '<STR_LIT>' , re . MULTILINE ) <EOL> self . assertRegexpMatches ( data , regex_hostname ) <EOL> def test_suse ( self ) : <EOL> """<STR_LIT>""" <EOL> data = self . _run_test ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( data , '<STR_LIT>' ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> agent_test . main ( ) </s>
