def test_sorter_adds_group_for_stackable_entitlement(self):
        ent1_prod = StubProduct("Product 1")
        ent1 = StubEntitlementCertificate(ent1_prod, stacking_id=3)
        entitlements = [ent1]

        sorter = EntitlementCertStackingGroupSorter(entitlements)
        self._assert_1_group_with_1_entitlement('Product 1', ent1, sorter)
    def test_sorter_adds_group_for_non_stackable_entitlement(self):
        ent1_prod = StubProduct("Product 1")
        ent1 = StubEntitlementCertificate(ent1_prod, stacking_id=None)
        entitlements = [ent1]

        sorter = EntitlementCertStackingGroupSorter(entitlements)
        # With no stacking id, we expect an empty group name
        self._assert_1_group_with_1_entitlement("", ent1, sorter)
示例#3
0
    def refresh(self):
        sorter = EntitlementCertStackingGroupSorter(self.entitlement_dir.list())
        self.store.clear()

        # FIXME: mapped list store inits are weird
        for group in sorter.groups:
            self._add_group(group)

        self.top_view.expand_all()
        self._stripe_rows(None, self.store)
        self.unsubscribe_button.set_property('sensitive', False)
        # 841396: Select first item in My Subscriptions table by default
        selection = self.top_view.get_selection()
        selection.select_path(0)
示例#4
0
 def update_subscriptions(self):
     """
     Pulls the entitlement certificates and updates the subscription model.
     """
     self.store.clear()
     sorter = EntitlementCertStackingGroupSorter(
         self.entitlement_dir.list())
     for idx, group in enumerate(sorter.groups):
         self._add_group(idx, group)
     self.top_view.expand_all()
     dbus_iface = get_dbus_iface()
     dbus_iface.check_status(ignore_reply=True)
     self.facts.refresh_validity_facts()
     self.unsubscribe_button.set_property('sensitive', False)
    def test_sorter_adds_multiple_entitlements_to_group_when_same_stacking_id(self):
        expected_stacking_id = 5

        ent1_prod = StubProduct("Product 1")
        ent1 = StubEntitlementCertificate(ent1_prod, stacking_id=expected_stacking_id)

        ent2_prod = StubProduct("Product 2")
        ent2 = StubEntitlementCertificate(ent2_prod, stacking_id=expected_stacking_id)
        entitlements = [ent1, ent2]

        sorter = EntitlementCertStackingGroupSorter(entitlements)
        self.assertEquals(1, len(sorter.groups))
        self.assertEquals("Product 1", sorter.groups[0].name)
        self.assertEquals(2, len(sorter.groups[0].entitlements))
        self.assertEquals(ent1, sorter.groups[0].entitlements[0])
        self.assertEquals(ent2, sorter.groups[0].entitlements[1])
示例#6
0
 def update_subscriptions(self, update_dbus=True):
     """
     Pulls the entitlement certificates and updates the subscription model.
     """
     self.store.clear()
     sorter = EntitlementCertStackingGroupSorter(
         self.entitlement_dir.list())
     for group in sorter.groups:
         self._add_group(group)
     self.top_view.expand_all()
     self._stripe_rows(None, self.store)
     if update_dbus:
         require(DBUS_IFACE).update()
     self.unsubscribe_button.set_property('sensitive', False)
     # 841396: Select first item in My Subscriptions table by default
     selection = self.top_view.get_selection()
     selection.select_path(0)
    def test_sorter_adds_multiple_groups_for_non_stacking_entitlements(self):
        ent1_prod = StubProduct("Product 1")
        ent1 = StubEntitlementCertificate(ent1_prod, stacking_id=None)

        ent2_prod = StubProduct("Product 2")
        ent2 = StubEntitlementCertificate(ent2_prod, stacking_id=None)

        entitlements = [ent1, ent2]

        sorter = EntitlementCertStackingGroupSorter(entitlements)
        self.assertEquals(2, len(sorter.groups))

        self.assertEquals('', sorter.groups[0].name)
        self.assertEquals(1, len(sorter.groups[0].entitlements))
        self.assertEquals(ent1, sorter.groups[0].entitlements[0])

        self.assertEquals('', sorter.groups[1].name)
        self.assertEquals(1, len(sorter.groups[1].entitlements))
        self.assertEquals(ent2, sorter.groups[1].entitlements[0])