Exemplo n.º 1
0
    def test_parse_ace_group_to_trustee(self):
        """
        ACE_DATA_RO = {
            "type": "QFS_ACE_TYPE_ALLOWED",
            "adgroupname": "data",
            "flags": INHERIT_ALL,
            "rights": RO
        }
        should become
        ACE_DATA_RO = {
            "type": "QFS_ACE_TYPE_ALLOWED",
            "trustee": "21474837589",
            "flags": INHERIT_ALL,
            "rights": RO
        }
        before being applied by set_acls()
        """
        ace_data_ro_with_groupname = {
            "type": "QFS_ACE_TYPE_ALLOWED",
            "adgroupname": "data",
            "flags": INHERIT_ALL,
            "rights": RO
        }

        ace_data_ro_target = {
            "type": "QFS_ACE_TYPE_ALLOWED",
            "trustee": "21474837589",
            "flags": INHERIT_ALL,
            "rights": RO
        }

        self.assertEqual(ace_data_ro_target,
                         qacls.parse_ace(ace_data_ro_with_groupname))
Exemplo n.º 2
0
 def test_parse_ace_nfsgroup_to_trustee(self):
     ace_data_ro_with_username = {
         "type": "QFS_ACE_TYPE_ALLOWED",
         "nfsgroupname": "production",
         "flags": INHERIT_ALL,
         "rights": RO
     }
     ace_data_ro_target = {
         "type": "QFS_ACE_TYPE_ALLOWED",
         "trustee": "17179879186",
         "flags": INHERIT_ALL,
         "rights": RO
     }
     self.assertEqual(ace_data_ro_target,
                      qacls.parse_ace(ace_data_ro_with_username))
Exemplo n.º 3
0
 def test_parse_ace_nfsuser_to_trustee(self):
     ace_data_ro_with_username = {
         "type": "QFS_ACE_TYPE_ALLOWED",
         "nfsusername": "******",
         "flags": INHERIT_ALL,
         "rights": RO
     }
     ace_data_ro_target = {
         "type": "QFS_ACE_TYPE_ALLOWED",
         "trustee": "12884911888",
         "flags": INHERIT_ALL,
         "rights": RO
     }
     self.assertEqual(ace_data_ro_target,
                      qacls.parse_ace(ace_data_ro_with_username))
Exemplo n.º 4
0
 def test_parse_ace_user_to_trustee(self):
     ace_data_ro_with_username = {
         "type": "QFS_ACE_TYPE_ALLOWED",
         "adusername": "******",
         "flags": INHERIT_ALL,
         "rights": RO
     }
     ace_data_ro_target = {
         "type": "QFS_ACE_TYPE_ALLOWED",
         "trustee": "21474836980",
         "flags": INHERIT_ALL,
         "rights": RO
     }
     self.assertEqual(ace_data_ro_target,
                      qacls.parse_ace(ace_data_ro_with_username))
Exemplo n.º 5
0
 def test_parse_ace_groupname_to_trustee(self):
     ace_data_ro_with_groupname = {
         "type": "QFS_ACE_TYPE_ALLOWED",
         "groupname": "production",
         "flags": INHERIT_ALL,
         "rights": RO
     }
     ace_data_ro_target = [
         {
             "type": "QFS_ACE_TYPE_ALLOWED",
             "trustee": "17179879186",
             "flags": INHERIT_ALL,
             "rights": RO
         },
         {
             "type": "QFS_ACE_TYPE_ALLOWED",
             "trustee": "21474837590",
             "flags": INHERIT_ALL,
             "rights": RO
         }
     ]
     result = qacls.parse_ace(ace_data_ro_with_groupname)
     print result
     self.assertEqual(ace_data_ro_target, result)