示例#1
0
def test_format_info():
    """
    Tests the formatting of returned user information
    """
    data = pwd.struct_passwd((
        "_TEST_GROUP",
        "*",
        83,
        83,
        "AMaViS Daemon",
        "/var/virusmails",
        "/usr/bin/false",
    ))
    ret = {
        "shell": "/usr/bin/false",
        "name": "_TEST_GROUP",
        "gid": 83,
        "groups": ["_TEST_GROUP"],
        "home": "/var/virusmails",
        "fullname": "AMaViS Daemon",
        "uid": 83,
    }
    with patch("salt.modules.mac_user.list_groups",
               MagicMock(return_value=["_TEST_GROUP"])):
        assert mac_user._format_info(data) == ret
示例#2
0
 def test_format_info(self):
     '''
     Tests the formatting of returned user information
     '''
     data = pwd.struct_passwd(('_TEST_GROUP', '*', 83, 83, 'AMaViS Daemon',
                               '/var/virusmails', '/usr/bin/false'))
     ret = {'shell': '/usr/bin/false', 'name': '_TEST_GROUP', 'gid': 83,
                  'groups': ['_TEST_GROUP'], 'home': '/var/virusmails',
                  'fullname': 'AMaViS Daemon', 'uid': 83}
     self.assertEqual(mac_user._format_info(data), ret)
示例#3
0
 def test_format_info(self):
     '''
     Tests the formatting of returned user information
     '''
     data = pwd.struct_passwd(('_TEST_GROUP', '*', 83, 83, 'AMaViS Daemon',
                               '/var/virusmails', '/usr/bin/false'))
     ret = {'shell': '/usr/bin/false', 'name': '_TEST_GROUP', 'gid': 83,
                  'groups': ['_TEST_GROUP'], 'home': '/var/virusmails',
                  'fullname': 'AMaViS Daemon', 'uid': 83}
     self.assertEqual(mac_user._format_info(data), ret)
示例#4
0
 def test_format_info(self):
     '''
     Tests the formatting of returned user information
     '''
     data = pwd.struct_passwd(('_TEST_GROUP', '*', 83, 83, 'AMaViS Daemon',
                               '/var/virusmails', '/usr/bin/false'))
     ret = {
         'shell': '/usr/bin/false',
         'name': '_TEST_GROUP',
         'gid': 83,
         'groups': ['_TEST_GROUP'],
         'home': '/var/virusmails',
         'fullname': 'AMaViS Daemon',
         'uid': 83
     }
     with patch('salt.modules.mac_user.list_groups',
                MagicMock(return_value=['_TEST_GROUP'])):
         self.assertEqual(mac_user._format_info(data), ret)