'Should raise DaemonError if no RLIMIT_CORE resource.'

def test_raises_error_when_no_core_resource(self):

    def mock_getrlimit(res):
        if (res == resource.RLIMIT_CORE):
            raise ValueError("Bogus    platform    doesn't    have    RLIMIT_CORE")
        else:
            return None
    resource.getrlimit.mock_returns_func = mock_getrlimit
    expect_error = daemon.daemon.DaemonOSEnvironmentError
    self.failUnlessRaises(expect_error, daemon.daemon.prevent_core_dump)
