|
| 1 | +========================== |
| 2 | +robotframework-unixfilesystem |
| 3 | +========================== |
| 4 | + |
| 5 | +**robotframework-unixfilesystem** is a `Robot Framework |
| 6 | +<http://code.google.com/p/robotframework/>`_ test library to test |
| 7 | +UNIX filesystem attributes like permissions, ownership etc. |
| 8 | + |
| 9 | +Installation |
| 10 | +++++++++++++ |
| 11 | + |
| 12 | +To install, just fetch the latest version from PyPI:. |
| 13 | + |
| 14 | + pip install --upgrade robotframework-unixfilesystem |
| 15 | + |
| 16 | +Usage |
| 17 | ++++++ |
| 18 | + |
| 19 | +Setup in the robotframework Settings section: |
| 20 | + |
| 21 | +============ ================ |
| 22 | + Setting Value |
| 23 | +============ ================ |
| 24 | +Library UnixFilesystemLibrary |
| 25 | +============ ================ |
| 26 | + |
| 27 | +\ |
| 28 | + |
| 29 | +These keyword actions are available:: |
| 30 | + |
| 31 | + Get Owner From Path: |
| 32 | + Does an lstat on the Path and returns the owner of the file/directory: |
| 33 | + |
| 34 | + Arguments: |
| 35 | + - path: the path to the file/directory you wish to get ownership on (e.g. /tmp/test.txt or ../foo) |
| 36 | + Return: |
| 37 | + - owner: returns the owner of the file (e.g. root or chris) |
| 38 | + |
| 39 | + Owner From Path Should Match: |
| 40 | + Does an lstat on the Path and checks to see if the supplied owner matches. |
| 41 | + Returns True if a match is found or False otherwise. |
| 42 | + |
| 43 | + Arguments: |
| 44 | + - owner: the username to check against ownership of the path (e.g. root or chris) |
| 45 | + - path: the path to the file/directory you wish to get ownership on (e.g. /tmp/test.txt or ../foo) |
| 46 | + Return: |
| 47 | + - returns True if the owner of the Path matches Owner, False otherwise |
| 48 | + |
| 49 | + Get Permissions From Path As Octal |
| 50 | + Gets the permissions via lstat of the supplied Path and returns those permissions as |
| 51 | + an octal value. |
| 52 | + |
| 53 | + Arguments: |
| 54 | + - path: the path to the file/directory you wish to get ownership on (e.g. /tmp/test.txt or ../foo) |
| 55 | + Return: |
| 56 | + - permissions: Returns the octal permissions of the path (e.g. 0755 or 0644) |
| 57 | + |
| 58 | + Permissions From Path Should Match: |
| 59 | + Gets the permissions via lstat of the supplied Path and checks if those permissions |
| 60 | + match the supplied Permissions. |
| 61 | + Returns True if a match is found or False otherwise. |
| 62 | + |
| 63 | + Arguments: |
| 64 | + - path: the path to the file/directory you wish to get ownership on (e.g. /tmp/test.txt or ../foo) |
| 65 | + - permissions: octal permissions (e.g. 0755 or 0644) |
| 66 | + Return: |
| 67 | + - returns True if the owner of the Path matches Permissions, False otherwise |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +Here is an example of how to use the library: |
| 72 | + |
| 73 | +================== ========================== =================================== |
| 74 | + Action Argument Argument |
| 75 | +================== ========================== =================================== |
| 76 | +${Owner}= Get Owner From Path path=/tmp/test.txt |
| 77 | +Should Match ${Owner} root |
| 78 | +================== ========================== =================================== |
| 79 | + |
| 80 | +Here is an example of how to check that the owner of a path matches the supplied owner |
| 81 | + |
| 82 | +============================ ========================== =================================== |
| 83 | + Action Argument Argument |
| 84 | +============================ ========================== =================================== |
| 85 | +Owner From Path Should Match root path=/tmp/text.txt |
| 86 | +============================ ========================== =================================== |
| 87 | + |
| 88 | +Here is an example of how to get permissions from the path as an octal |
| 89 | + |
| 90 | +================== ================================== =================================== |
| 91 | + Action Argument Argument |
| 92 | +================== ================================== =================================== |
| 93 | +${Permissions} Get Permissions From Path as Octal path=/tmp/ |
| 94 | +Should Match ${Permissions} 0644 |
| 95 | +================== ================================== =================================== |
| 96 | + |
| 97 | +Here is an example of how to check that permissions from the path match the octal |
| 98 | + |
| 99 | +================================== ========================== |
| 100 | + Action Argument |
| 101 | +================================== ========================== |
| 102 | +Permissions From Path Should Match 0644 |
| 103 | +================================== ========================== |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | +License |
| 108 | ++++++++ |
| 109 | + |
| 110 | +The robotframework-unixfilesystem is licensed under the `Apache 2.0 License |
| 111 | +<http://www.apache.org/licenses/LICENSE-2.0.html>`_. |
0 commit comments