<s> import os <EOL> import mock <EOL> from nova . compute import arch <EOL> from nova import exception <EOL> from nova import test <EOL> class ArchTest ( test . NoDBTestCase ) : <EOL> @ mock . patch . object ( os , "<STR_LIT>" ) <EOL> def test_host ( self , mock_uname ) : <EOL> os . uname . return_value = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertEqual ( arch . I686 , arch . from_host ( ) ) <EOL> def test_valid_string ( self ) : <EOL> self . assertTrue ( arch . is_valid ( "<STR_LIT>" ) ) <EOL> def test_valid_constant ( self ) : <EOL> self . assertTrue ( arch . is_valid ( arch . X86_64 ) ) <EOL> def test_valid_bogus ( self ) : <EOL> self . assertFalse ( arch . is_valid ( "<STR_LIT>" ) ) <EOL> def test_canonicalize_i386 ( self ) : <EOL> self . assertEqual ( arch . I686 , arch . canonicalize ( "<STR_LIT>" ) ) <EOL> def test_canonicalize_amd64 ( self ) : <EOL> self . assertEqual ( arch . X86_64 , arch . canonicalize ( "<STR_LIT>" ) ) <EOL> def test_canonicalize_case ( self ) : <EOL> self . assertEqual ( arch . X86_64 , arch . canonicalize ( "<STR_LIT>" ) ) <EOL> def test_canonicalize_compat_xen1 ( self ) : <EOL> self . assertEqual ( arch . I686 , arch . canonicalize ( "<STR_LIT>" ) ) <EOL> def test_canonicalize_compat_xen2 ( self ) : <EOL> self . assertEqual ( arch . I686 , arch . canonicalize ( "<STR_LIT>" ) ) <EOL> def test_canonicalize_bogus ( self ) : <EOL> self . assertRaises ( exception . InvalidArchitectureName , <EOL> arch . canonicalize , <EOL> "<STR_LIT>" ) </s>
