def test_ent_source(self): yc = self.create_content("yum", "yum_content") oc = self.create_content("ostree", "ostree_content") ent1 = Entitlement(contents=[yc]) ent2 = Entitlement(contents=[oc]) ent_src = EntitlementSource() ent_src._entitlements = [ent1, ent2] contents = find_content(ent_src, content_type=action_invoker.OSTREE_CONTENT_TYPE) self.assertEquals(len(contents), 1) for content in contents: self.assertEquals(content.content_type, action_invoker.OSTREE_CONTENT_TYPE)
def test_ent_source(self): yc = self.create_content("yum", "yum_content") oc = self.create_content("ostree", "ostree_content") ent1 = Entitlement(contents=[yc]) ent2 = Entitlement(contents=[oc]) ent_src = EntitlementSource() ent_src._entitlements = [ent1, ent2] contents = find_content(ent_src, content_type=action_invoker.OSTREE_CONTENT_TYPE) self.assertEqual(len(contents), 1) for content in contents: self.assertEqual(content.content_type, action_invoker.OSTREE_CONTENT_TYPE)
def test_ent_source_product_tags(self): yc = self.create_content("yum", "yum_content") oc = self.create_content("ostree", "ostree_content") ent1 = Entitlement(contents=[yc]) ent2 = Entitlement(contents=[oc]) ent_src = EntitlementSource() ent_src._entitlements = [ent1, ent2] # faux product_tags to hit find_content, but no content tags ent_src.product_tags = ["awesomeos-ostree-1", "awesomeos-ostree-super"] contents = find_content(ent_src, content_type=action_invoker.OSTREE_CONTENT_TYPE) self.assertEquals(len(contents), 1) for content in contents: self.assertEquals(content.content_type, action_invoker.OSTREE_CONTENT_TYPE)
def test_ent_source_product_tags_and_content_tags(self): oc = self.create_content("ostree", "ostree_content") oc.tags = ["awesomeos-ostree-1"] ent = Entitlement(contents=[oc]) ent_src = EntitlementSource() ent_src._entitlements = [ent] # faux product_tags to hit find_content, but no content tags ent_src.product_tags = ["awesomeos-ostree-1", "awesomeos-ostree-super"] contents = find_content(ent_src, content_type=action_invoker.OSTREE_CONTENT_TYPE) print("contents", contents) self.assertEqual(len(contents), 1) for content in contents: self.assertEqual(content.content_type, action_invoker.OSTREE_CONTENT_TYPE)
def test_ent_source_product_tags(self): yc = self.create_content("yum", "yum_content") oc = self.create_content("ostree", "ostree_content") ent1 = Entitlement(contents=[yc]) ent2 = Entitlement(contents=[oc]) ent_src = EntitlementSource() ent_src._entitlements = [ent1, ent2] # faux product_tags to hit find_content, but no content tags ent_src.product_tags = ['awesomeos-ostree-1', 'awesomeos-ostree-super'] contents = find_content( ent_src, content_type=action_invoker.OSTREE_CONTENT_TYPE) self.assertEquals(len(contents), 1) for content in contents: self.assertEquals(content.content_type, action_invoker.OSTREE_CONTENT_TYPE)
def test_ent_source_product_tags_and_content_tags(self): oc = self.create_content("ostree", "ostree_content") oc.tags = ['awesomeos-ostree-1'] ent = Entitlement(contents=[oc]) ent_src = EntitlementSource() ent_src._entitlements = [ent] # faux product_tags to hit find_content, but no content tags ent_src.product_tags = ['awesomeos-ostree-1', 'awesomeos-ostree-super'] contents = find_content(ent_src, content_type=action_invoker.OSTREE_CONTENT_TYPE) print "contents", contents self.assertEquals(len(contents), 1) for content in contents: self.assertEquals(content.content_type, action_invoker.OSTREE_CONTENT_TYPE)
def test_empty(self, mock_file_store): # FIXME: This does no validation mock_repo_file = mock.Mock() mock_repo_file.get_core.return_value = {} mock_file_store.load.return_value = mock_repo_file ent_src = EntitlementSource() action = action_invoker.OstreeContentUpdateActionCommand(ent_source=ent_src) action.update_origin_file = mock.Mock() action.perform()