(self, open, geteuid, maybe_drop,
signals, pidlock)
| 577 | @patch('os.geteuid') |
| 578 | @patch('builtins.open') |
| 579 | def test_default(self, open, geteuid, maybe_drop, |
| 580 | signals, pidlock): |
| 581 | geteuid.return_value = 0 |
| 582 | context = detached(uid='user', gid='group') |
| 583 | assert isinstance(context, DaemonContext) |
| 584 | signals.reset.assert_called_with('SIGCLD') |
| 585 | maybe_drop.assert_called_with(uid='user', gid='group') |
| 586 | open.return_value = Mock() |
| 587 | |
| 588 | geteuid.return_value = 5001 |
| 589 | context = detached(uid='user', gid='group', logfile='/foo/bar') |
| 590 | assert isinstance(context, DaemonContext) |
| 591 | assert context.after_chdir |
| 592 | context.after_chdir() |
| 593 | open.assert_called_with('/foo/bar', 'a') |
| 594 | open.return_value.close.assert_called_with() |
| 595 | |
| 596 | context = detached(pidfile='/foo/bar/pid') |
| 597 | assert isinstance(context, DaemonContext) |
| 598 | assert context.after_chdir |
| 599 | context.after_chdir() |
| 600 | pidlock.assert_called_with('/foo/bar/pid') |
| 601 | |
| 602 | |
| 603 | @t.skip.if_win32 |
nothing calls this directly
no test coverage detected