8
10
from lazr.lifecycle.snapshot import Snapshot
10
13
from storm.store import Store
11
14
from testtools import ExpectedException
12
15
from testtools.matchers import (
16
21
from zope.component import getUtility
17
22
from zope.security.interfaces import Unauthorized
18
23
from zope.security.proxy import removeSecurityProxy
40
from lp.registry.interfaces.oopsreferences import IHasOOPSReferences
35
41
from lp.registry.interfaces.person import IPersonSet
36
42
from lp.registry.interfaces.series import SeriesStatus
37
43
from lp.registry.tests.test_distroseries import (
215
222
setattr, distro, "package_derivatives_email", "foo")
224
def test_implements_interfaces(self):
225
# Distribution fully implements its interfaces.
226
distro = removeSecurityProxy(self.factory.makeDistribution())
227
expected_interfaces = [
230
provides_all = MatchesAll(*map(Provides, expected_interfaces))
231
self.assertThat(distro, provides_all)
218
234
class TestDistributionCurrentSourceReleases(
219
235
TestDistroSeriesCurrentSourceReleases):
342
358
self.distribution = self.factory.makeDistribution(name="boobuntu")
344
360
def test_snapshot(self):
345
"""Snapshots of products should not include marked attribues.
361
"""Snapshots of distributions should not include marked attribues.
347
363
Wrap an export with 'doNotSnapshot' to force the snapshot to not
348
364
include that attribute.
528
544
distro.translation_focus = new_series
529
545
distro.translationgroup = new_group
530
546
distro.translationpermission = TranslationPermission.CLOSED
549
class TestWebService(WebServiceTestCase):
551
def test_oops_references_matching_distro(self):
552
# The distro layer provides the context restriction, so we need to
553
# check we can access context filtered references - e.g. on question.
554
oopsid = "OOPS-abcdef1234"
555
distro = self.factory.makeDistribution()
556
question = self.factory.makeQuestion(
557
title="Crash with %s" % oopsid, target=distro)
559
ws_distro = self.wsObject(distro, distro.owner)
560
now = datetime.datetime.now(tz=pytz.utc)
561
day = datetime.timedelta(days=1)
562
self.failUnlessEqual(
564
ws_distro.findReferencedOOPS(start_date=now - day, end_date=now))
565
self.failUnlessEqual(
567
ws_distro.findReferencedOOPS(
568
start_date=now + day, end_date=now + day))
570
def test_oops_references_different_distro(self):
571
# The distro layer provides the context restriction, so we need to
572
# check the filter is tight enough - other contexts should not work.
573
oopsid = "OOPS-abcdef1234"
574
self.factory.makeQuestion(title="Crash with %s" % oopsid)
575
distro = self.factory.makeDistribution()
577
ws_distro = self.wsObject(distro, distro.owner)
578
now = datetime.datetime.now(tz=pytz.utc)
579
day = datetime.timedelta(days=1)
580
self.failUnlessEqual(
582
ws_distro.findReferencedOOPS(start_date=now - day, end_date=now))