Example #1
0
    def test_05_iso_permissions(self):
        """Update & Test for ISO permissions"""

        # validate the following
        # 1. listIsos returns valid permissions set for ISO
        # 2. permission changes should be reflected in vm_template
        #    table in database

        self.debug("Updating permissions for ISO: %s" % self.iso_2.id)

        cmd = updateIsoPermissions.updateIsoPermissionsCmd()
        cmd.id = self.iso_2.id
        # Update ISO permissions
        cmd.isfeatured = self.services["isfeatured"]
        cmd.ispublic = self.services["ispublic"]
        cmd.isextractable = self.services["isextractable"]
        self.apiclient.updateIsoPermissions(cmd)

        # Verify ListIsos have updated permissions for the ISO for normal user
        list_iso_response = list_isos(self.apiclient,
                                      id=self.iso_2.id,
                                      account=self.account.name,
                                      domainid=self.account.domainid)
        self.assertEqual(isinstance(list_iso_response, list), True,
                         "Check list response returns a valid list")

        iso_response = list_iso_response[0]

        self.assertEqual(iso_response.id, self.iso_2.id, "Check ISO ID")
        self.assertEqual(iso_response.ispublic, self.services["ispublic"],
                         "Check ispublic permission of ISO")

        self.assertEqual(iso_response.isfeatured, self.services["isfeatured"],
                         "Check isfeatured permission of ISO")
        return
Example #2
0
    def test_05_iso_permissions(self):
        """Update & Test for ISO permissions"""

        # validate the following
        # 1. listIsos returns valid permissions set for ISO
        # 2. permission changes should be reflected in vm_template
        #    table in database

        self.debug("Updating permissions for ISO: %s" % self.iso_2.id)

        cmd = updateIsoPermissions.updateIsoPermissionsCmd()
        cmd.id = self.iso_2.id
        # Update ISO permissions
        cmd.isfeatured = self.services["isfeatured"]
        cmd.ispublic = self.services["ispublic"]
        cmd.isextractable = self.services["isextractable"]
        self.apiclient.updateIsoPermissions(cmd)

        # Verify ListIsos have updated permissions for the ISO for normal user
        list_iso_response = list_isos(
            self.apiclient,
            id=self.iso_2.id,
            account=self.account.name,
            domainid=self.account.domainid
        )
        self.assertEqual(
            isinstance(list_iso_response, list),
            True,
            "Check list response returns a valid list"
        )

        iso_response = list_iso_response[0]

        self.assertEqual(
            iso_response.id,
            self.iso_2.id,
            "Check ISO ID"
        )
        self.assertEqual(
            iso_response.ispublic,
            self.services["ispublic"],
            "Check ispublic permission of ISO"
        )

        self.assertEqual(
            iso_response.isfeatured,
            self.services["isfeatured"],
            "Check isfeatured permission of ISO"
        )
        return