def test_linux_user_primary_group(self, grains=None):
        name = 'saltyuser'

        # Create a user to test primary group function
        if self.run_function('user.add', [name]) is not True:
            self.run_function('user.delete', [name])
            self.skipTest('Failed to create a user')

        try:
            # Test useradd.primary_group
            primary_group = self.run_function('user.primary_group', [name])
            uid_info = self.run_function('user.info', [name])
            self.assertIn(primary_group, uid_info['groups'])

        except:
            self.run_function('user.delete', [name])
            raise
Tests the primary_group function
dataset/ETHPy150Open saltstack/salt/tests/integration/modules/useradd.py/UseraddModuleTest.test_linux_user_primary_group