978
979
parent_series=parent_series,
979
980
difference_type=(
980
981
DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES)))
982
diffs['missing'].append(
983
self.factory.makeDistroSeriesDifference(
984
derived_series=derived_series,
985
parent_series=parent_series,
987
DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES)))
981
988
diffs['ignored'].append(
982
989
self.factory.makeDistroSeriesDifference(
983
990
derived_series=derived_series,
1043
1050
self.assertFalse(diff_for_other_series in results)
1052
def test_getForDistroSeries_does_not_filter_dsd_type_by_default(self):
1053
# If no difference_type is given, getForDistroSeries returns
1054
# DSDs of all types (missing in derived series, different
1055
# versions, or unique to derived series).
1056
derived_series = self.makeDerivedSeries()
1058
self.factory.makeDistroSeriesDifference(
1059
derived_series, difference_type=diff_type)
1060
for diff_type in DistroSeriesDifferenceType.items]
1061
dsd_source = getUtility(IDistroSeriesDifferenceSource)
1062
self.assertContentEqual(
1063
dsds, dsd_source.getForDistroSeries(derived_series))
1045
1065
def test_getForDistroSeries_filters_by_type(self):
1046
1066
# Only differences for the specified types are returned.
1047
1067
derived_series = self.makeDerivedSeries()
1067
1087
def test_getForDistroSeries_filters_by_multiple_statuses(self):
1068
1088
# Multiple statuses can be passed for filtering.
1069
1089
derived_series = self.makeDerivedSeries()
1070
diffs = self.makeDiffsForDistroSeries(derived_series)
1072
result = getUtility(IDistroSeriesDifferenceSource).getForDistroSeries(
1075
DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
1076
DistroSeriesDifferenceStatus.NEEDS_ATTENTION,
1079
self.assertContentEqual(diffs['normal'] + diffs['ignored'], result)
1090
for status in DistroSeriesDifferenceStatus.items:
1091
self.factory.makeDistroSeriesDifference(
1092
derived_series, status=status)
1095
DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
1096
DistroSeriesDifferenceStatus.NEEDS_ATTENTION,
1099
dsd_source = getUtility(IDistroSeriesDifferenceSource)
1100
self.assertContentEqual(
1103
for dsd in dsd_source.getForDistroSeries(
1104
derived_series, status=statuses)])
1081
1106
def test_getForDistroSeries_matches_by_package_name(self):
1082
1107
dsd = self.factory.makeDistroSeriesDifference()
1138
1163
def test_getForDistroSeries_filters_by_parent(self):
1139
1164
# The differences can be filtered by parent series.
1140
dsp = self.factory.makeDistroSeriesParent()
1141
derived_series = dsp.derived_series
1142
parent_series = dsp.parent_series
1144
# Add another parent to this series.
1145
parent_series2 = self.factory.makeDistroSeriesParent(
1146
derived_series=derived_series).parent_series
1148
diffs = self.makeDiffsForDistroSeries(
1149
derived_series, parent_series=parent_series)
1150
diffs2 = self.makeDiffsForDistroSeries(
1151
derived_series, parent_series=parent_series2)
1153
results = getUtility(
1154
IDistroSeriesDifferenceSource).getForDistroSeries(
1155
derived_series, parent_series=parent_series)
1156
results2 = getUtility(
1157
IDistroSeriesDifferenceSource).getForDistroSeries(
1158
derived_series, parent_series=parent_series2)
1160
self.assertContentEqual(diffs['normal'], results)
1161
self.assertContentEqual(diffs2['normal'], results2)
1165
derived_series = self.factory.makeDistroSeries()
1167
self.factory.makeDistroSeriesParent(derived_series=derived_series)
1168
for counter in xrange(2)]
1170
self.factory.makeDistroSeriesDifference(
1171
parent_series=dsp.parent_series,
1172
derived_series=derived_series)
1174
dsd_source = getUtility(IDistroSeriesDifferenceSource)
1175
self.assertContentEqual(
1177
dsd_source.getForDistroSeries(
1178
derived_series, parent_series=dsps[0].parent_series))
1163
1180
def test_getForDistroSeries_matches_packageset(self):
1164
1181
dsd = self.factory.makeDistroSeriesDifference()