mirror of https://github.com/ansible/ansible.git
Refactor structure of group module integration tests (#78652)
This to match the structure with the tests for the user module. When having the tests available as stand-alone tests, it will be easier to add more integration tests in the future.pull/78172/head
parent
196084773b
commit
a3531ac422
@ -0,0 +1,23 @@
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import grp
|
||||
|
||||
|
||||
def main():
|
||||
gids = [g.gr_gid for g in grp.getgrall()]
|
||||
|
||||
# Start the gid numbering with 1
|
||||
# FreeBSD doesn't support the usage of gid 0, it doesn't fail (rc=0) but instead a number in the normal
|
||||
# range is picked.
|
||||
i = 1
|
||||
while True:
|
||||
if i not in gids:
|
||||
print(i)
|
||||
break
|
||||
i += 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import grp
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
group_name = None
|
||||
if len(sys.argv) >= 2:
|
||||
group_name = sys.argv[1]
|
||||
|
||||
print(grp.getgrnam(group_name).gr_gid)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import grp
|
||||
|
||||
gids = [g.gr_gid for g in grp.getgrall()]
|
||||
|
||||
i = 0
|
||||
while True:
|
||||
if i not in gids:
|
||||
print(i)
|
||||
break
|
||||
i += 1
|
||||
Loading…
Reference in New Issue