예제 #1
0
    def test_partial_and_invalid_fact(self, mock_sorter):

        ents = []
        stub_product = StubProduct('1005')

        stub_ent_cert = StubEntitlementCertificate(stub_product, quantity=2, stacking_id='stack1', sockets=2)

        ents.append(stub_ent_cert)
        entitlement_directory = StubCertificateDirectory(ents)

        product = StubProduct("product1")
        product_directory = StubCertificateDirectory([
                StubProductCertificate(product)])

        mock_sorter_instance = mock_sorter.return_value
        mock_sorter_instance.partially_valid_products = {'foo': 'blah'}
        mock_sorter_instance.unentitled_products = {'bar': 'apple'}
        mock_sorter_instance.expired_products = {}
        mock_sorter_instance.partial_stacks = {}

        facts = Facts(None)
        facts.product_dir = product_directory
        facts.entitlement_dir = entitlement_directory
        facts_dict = facts.get_facts()
        self.assertEquals("invalid", facts_dict['system.entitlements_valid'])
예제 #2
0
    def test_partial_and_invalid_fact(self, mock_sorter):

        ents = []
        stub_product = StubProduct('1005')

        stub_ent_cert = StubEntitlementCertificate(stub_product, quantity=2, stacking_id='stack1', sockets=2)

        ents.append(stub_ent_cert)
        entitlement_directory = StubCertificateDirectory(ents)

        product = StubProduct("product1")
        product_directory = StubCertificateDirectory([
                StubProductCertificate(product)])

        mock_sorter_instance = mock_sorter.return_value
        mock_sorter_instance.partially_valid_products = {'foo': 'blah'}
        mock_sorter_instance.unentitled_products = {'bar': 'apple'}
        mock_sorter_instance.expired_products = {}
        mock_sorter_instance.partial_stacks = {}

        facts = Facts(None)
        facts.product_dir = product_directory
        facts.entitlement_dir = entitlement_directory
        facts_dict = facts.get_facts()
        self.assertEquals("invalid", facts_dict['system.entitlements_valid'])
예제 #3
0
    def test_no_entitlement_for_installed_product_shows_invalid(self):
        product = StubProduct("product1")
        product_directory = StubCertificateDirectory([
            StubProductCertificate(product)])
        entitlement_directory = StubCertificateDirectory([])

        facts = Facts(None)
        facts.product_dir = product_directory
        facts.entitlement_dir = entitlement_directory
        facts_dict = facts.get_facts()
        self.assertEquals("invalid", facts_dict['system.entitlements_valid'])
예제 #4
0
    def test_no_entitlement_for_installed_product_shows_invalid(self):
        product = StubProduct("product1")
        product_directory = StubCertificateDirectory([
            StubProductCertificate(product)])
        entitlement_directory = StubCertificateDirectory([])

        facts = Facts(None)
        facts.product_dir = product_directory
        facts.entitlement_dir = entitlement_directory
        facts_dict = facts.get_facts()
        self.assertEquals("invalid", facts_dict['system.entitlements_valid'])
예제 #5
0
    def test_future_dated_entitlement_shows_invalid(self):
        product = StubProduct("product1")
        product_directory = StubCertificateDirectory([
                StubProductCertificate(product)])
        entitlement_directory = StubCertificateDirectory([
                StubEntitlementCertificate(product,
                                           start_date=(datetime.now() + timedelta(days=1365)))])

        facts = Facts(None)
        facts.product_dir = product_directory
        facts.entitlement_dir = entitlement_directory
        facts_dict = facts.get_facts()
        self.assertEquals("invalid", facts_dict['system.entitlements_valid'])
예제 #6
0
    def test_entitlement_for_installed_product_shows_valid(self, mockCustomFacts):
        product = StubProduct("product1")
        product_directory = StubCertificateDirectory([
            StubProductCertificate(product)])
        entitlement_directory = StubCertificateDirectory([
            StubEntitlementCertificate(product)])

        facts = Facts(None)
        facts.product_dir = product_directory
        facts.entitlement_dir = entitlement_directory
        mockCustomFacts.return_value = {}
        facts_dict = facts.get_facts()
        self.assertEquals("valid", facts_dict['system.entitlements_valid'])
예제 #7
0
    def test_future_dated_entitlement_shows_invalid(self):
        product = StubProduct("product1")
        product_directory = StubCertificateDirectory([
                StubProductCertificate(product)])
        entitlement_directory = StubCertificateDirectory([
                StubEntitlementCertificate(product,
                                           start_date=(datetime.now() + timedelta(days=1365)))])

        facts = Facts(None)
        facts.product_dir = product_directory
        facts.entitlement_dir = entitlement_directory
        facts_dict = facts.get_facts()
        self.assertEquals("invalid", facts_dict['system.entitlements_valid'])