def test_bsd_jail_id(self, call_mock): """ Tests the bsd_jail_id function. """ responses = { '1111': ['JID', ' 1'], '2222': ['JID', ' 0'], '3333': ['JID', 'bad data'], '4444': ['bad data'], '5555': [], '6666': [] } call_mock.side_effect = mock_call(system.GET_BSD_JAIL_ID_PS, responses) for test_input in responses: expected_response = 1 if test_input == '1111' else 0 self.assertEqual(expected_response, system.bsd_jail_id(test_input))