#NEWLINE# @ requires_system_grains #NEWLINE# def test_groups_includes_primary( self , grains = None ) : #NEWLINE# #INDENT# uname = self . __random_string ( ) #NEWLINE# if ( self . run_function ( 'user.add' , [ uname ] ) is not True ) : #NEWLINE# #INDENT# self . run_function ( 'user.delete' , [ uname , True , True ] ) #NEWLINE# self . skipTest ( 'Failed to create user' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# uinfo = self . run_function ( 'user.info' , [ uname ] ) #NEWLINE# if ( grains [ 'os_family' ] in ( 'Suse' , ) ) : #NEWLINE# #INDENT# self . assertIn ( 'users' , uinfo [ 'groups' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertIn ( uname , uinfo [ 'groups' ] ) #NEWLINE# #UNINDENT# uid = uinfo [ 'uid' ] #NEWLINE# self . run_function ( 'user.delete' , [ uname , True , True ] ) #NEWLINE# gname = self . __random_string ( ) #NEWLINE# if ( self . run_function ( 'group.add' , [ gname ] ) is not True ) : #NEWLINE# #INDENT# self . run_function ( 'group.delete' , [ gname , True , True ] ) #NEWLINE# self . skipTest ( 'Failed to create group' ) #NEWLINE# #UNINDENT# ginfo = self . run_function ( 'group.info' , [ gname ] ) #NEWLINE# if ( self . run_function ( 'user.add' , [ uname , uid , ginfo [ 'gid' ] ] ) is False ) : #NEWLINE# #INDENT# self . run_function ( 'user.delete' , [ uname , True , True ] ) #NEWLINE# self . skipTest ( 'Failed to create user' ) #NEWLINE# #UNINDENT# uinfo = self . run_function ( 'user.info' , [ uname ] ) #NEWLINE# self . assertIn ( gname , uinfo [ 'groups' ] ) #NEWLINE# #UNINDENT# except AssertionError : #NEWLINE# #INDENT# self . run_function ( 'user.delete' , [ uname , True , True ] ) #NEWLINE# raise