But Job's afflictions had nothing to do with him, and were not a test for him, but a demonstration to Satan. Three of Job's friends suggested that it was a test for him, but God, eventually assured him that it wasn't.
Satan claimed that he could get Job to curse him, that he only loved him because his life was good, and he was happy. God meant to show Satan that this was not the case, that Job would not curse him even if his life was >-bleeped-<, so Satan preceded to make his life >-bleeped-<, and Job did not curse him. God was not testing his faith and devotion, he was already sure of it. It was Satan that wasn't, and didn't believe that it was true devotion. Job's misfortunes were a product of a demonstration to Satan, and not a test from God at all.