def get_flavors(self, public, promoted): flavors = self._get_public_flavors(public, promoted) flavor_collection = FlavorCollection(flavors) if not public and not promoted: private_flavors = self._get_private_flavors() self._remove_duplicated_flavors(flavors, private_flavors) flavor_collection.extend(private_flavors) return flavor_collection
def flavor_collection_extend_list_test(): flavor1 = util.create_example_flavor() flavor2 = util.create_secondary_example_flavor() flavor_collection1 = FlavorCollection([]) flavor_collection2 = FlavorCollection([flavor1]) flavor_collection3 = FlavorCollection([flavor2]) flavors = [flavor1] flavor_collection1.extend(flavor_collection2) assert flavor_collection1.flavors == flavors flavors = [flavor1, flavor2] flavor_collection1.extend(flavor_collection3) assert flavor_collection1.flavors == flavors