| 1 |
""" |
| 2 |
Module to test man page functionality of click-man package. |
| 3 |
""" |
| 4 |
|
| 5 |
from click_man.man import ManPage |
| 6 |
|
| 7 |
|
| 8 |
def test_simple_man_page(): |
| 9 |
""" |
| 10 |
Test creating most simple man page |
| 11 |
""" |
| 12 |
man = ManPage('my-command') |
| 13 |
man.short_help = 'Command to test man pages for click.' |
| 14 |
man.date = '21-Feb-1994' |
| 15 |
assert ( |
| 16 |
str(man) |
| 17 |
== r""".TH "MY-COMMAND" "1" "21-Feb-1994" "1.0.0" "my-command Manual" |
| 18 |
.SH NAME |
| 19 |
my-command \- Command to test man pages for click. |
| 20 |
.SH SYNOPSIS |
| 21 |
.B my-command |
| 22 |
""" |
| 23 |
) |
| 24 |
|
| 25 |
|
| 26 |
def test_full_man_page(): |
| 27 |
""" |
| 28 |
Test creating man page with all options set |
| 29 |
""" |
| 30 |
man = ManPage('my-command') |
| 31 |
man.short_help = 'Command to test man pages for click.' |
| 32 |
man.date = '21-Feb-1994' |
| 33 |
man.synopsis = '[--yolo] [--iambatman]' |
| 34 |
man.description = """This is my awesome |
| 35 |
|
| 36 |
multi line description of a click-man test. |
| 37 |
|
| 38 |
Boaa, richtig geili sach.""" |
| 39 |
|
| 40 |
man.options = [ |
| 41 |
('--yolo', 'Do it in yolo style'), |
| 42 |
('--iambatman', 'Make me think I am batman'), |
| 43 |
] |
| 44 |
man.commands = [ |
| 45 |
('start', 'Start it'), |
| 46 |
('stop', 'Stop it'), |
| 47 |
('test', 'Pretend you are testing your code'), |
| 48 |
] |
| 49 |
|
| 50 |
assert ( |
| 51 |
str(man) |
| 52 |
== r""".TH "MY-COMMAND" "1" "21-Feb-1994" "1.0.0" "my-command Manual" |
| 53 |
.SH NAME |
| 54 |
my-command \- Command to test man pages for click. |
| 55 |
.SH SYNOPSIS |
| 56 |
.B my-command |
| 57 |
[\-\-yolo] [\-\-iambatman] |
| 58 |
.SH DESCRIPTION |
| 59 |
This is my awesome |
| 60 |
.PP |
| 61 |
multi line description of a click-man test. |
| 62 |
.PP |
| 63 |
Boaa, richtig geili sach. |
| 64 |
.SH OPTIONS |
| 65 |
.TP |
| 66 |
\fB\-\-yolo\fP |
| 67 |
Do it in yolo style |
| 68 |
.TP |
| 69 |
\fB\-\-iambatman\fP |
| 70 |
Make me think I am batman |
| 71 |
.SH COMMANDS |
| 72 |
.PP |
| 73 |
\fBstart\fP |
| 74 |
Start it |
| 75 |
See \fBmy-command-start(1)\fP for full documentation on the \fBstart\fP command. |
| 76 |
.PP |
| 77 |
\fBstop\fP |
| 78 |
Stop it |
| 79 |
See \fBmy-command-stop(1)\fP for full documentation on the \fBstop\fP command. |
| 80 |
.PP |
| 81 |
\fBtest\fP |
| 82 |
Pretend you are testing your code |
| 83 |
See \fBmy-command-test(1)\fP for full documentation on the \fBtest\fP command. |
| 84 |
""" |
| 85 |
) |