~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/browser/tests/archive-views.txt

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-10 19:46:57 UTC
  • mfrom: (13137.1.21 ppa-api)
  • Revision ID: launchpad@pqm.canonical.com-20110610194657-qpovv3hj69uyqpw8
[r=gmb][bug=776444,
 776449] Provide PPA dependency controls via the web service.

Show diffs side-by-side

added added

removed removed

Lines of Context:
753
753
    mark/ppa
754
754
 
755
755
    >>> print dependency.title.escapedtext
756
 
    <a href="http://launchpad.dev/~mark/+archive/ppa">PPA for Mark Shuttleworth</a>
 
756
    <a href="http://launchpad.dev/~mark/+archive/ppa">PPA for Mark
 
757
    Shuttleworth</a>
757
758
 
758
759
The form focus, now that we have a recorded dependencies, is set to the
759
760
first listed dependency.
1387
1388
    >>> ppa_archive_view = create_initialized_view(
1388
1389
    ...     cprov.archive, name="+admin")
1389
1390
 
1390
 
The validate_external_dependencies() method is called when validating and will
1391
 
return a list of errors if the data dis not validate.  A valid entry is of the
1392
 
form:
 
1391
    >>> from lp.soyuz.interfaces.archive import validate_external_dependencies
 
1392
 
 
1393
The validate_external_dependencies() function is called when validating and
 
1394
will return a list of errors if the data dis not validate.  A valid entry is
 
1395
of the form:
1393
1396
    deb scheme://domain/ suite component[s]
1394
1397
 
1395
 
    >>> print ppa_archive_view.validate_external_dependencies(
 
1398
    >>> print validate_external_dependencies(
1396
1399
    ...     "deb http://example.com/ karmic main")
1397
1400
    []
1398
1401
 
1399
1402
Multiple entries are valid, separated by newlines:
1400
1403
 
1401
 
    >>> print ppa_archive_view.validate_external_dependencies(
 
1404
    >>> print validate_external_dependencies(
1402
1405
    ...     "deb http://example.com/ karmic main\n"
1403
1406
    ...     "deb http://example.com/ karmic restricted")
1404
1407
    []
1405
1408
 
1406
1409
If the line does not start with the word "deb" it fails:
1407
1410
 
1408
 
    >>> print ppa_archive_view.validate_external_dependencies(
 
1411
    >>> print validate_external_dependencies(
1409
1412
    ...     "deb http://example.com/ karmic universe\n"
1410
1413
    ...     "dab http://example.com/ karmic main")
1411
1414
    ["dab http://example.com/ karmic main: Must start with 'deb'"]
1412
1415
 
1413
1416
If the line has too few parts it fails.  Here we're missing a suite:
1414
1417
 
1415
 
    >>> print ppa_archive_view.validate_external_dependencies(
 
1418
    >>> print validate_external_dependencies(
1416
1419
    ...     "deb http://example.com/ karmic universe\n"
1417
1420
    ...     "deb http://example.com/ main")
1418
1421
    ["'deb http://example.com/ main'
1420
1423
 
1421
1424
If the URL looks invalid, it fails:
1422
1425
 
1423
 
    >>> print ppa_archive_view.validate_external_dependencies(
 
1426
    >>> print validate_external_dependencies(
1424
1427
    ...     "deb http://example.com/ karmic universe\n"
1425
1428
    ...     "deb example.com/ karmic main")
1426
1429
    ['deb example.com/ karmic main: Invalid URL']