~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/doc/commercialsubscription.txt

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-25 08:55:37 UTC
  • mfrom: (13287.1.8 bug-800652)
  • Revision ID: launchpad@pqm.canonical.com-20110625085537-moikyoo2pe98zs7r
[r=jcsackett, julian-edwards][bug=800634,
        800652] Enable and display overrides on sync package uploads.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
which does not qualify for free hosting, has an unexpired subscription.
7
7
 
8
8
    >>> from zope.component import getUtility
9
 
    >>> from lp.services.webapp.testing import verifyObject
 
9
    >>> from canonical.launchpad.webapp.testing import verifyObject
10
10
    >>> from lp.registry.interfaces.commercialsubscription import (
11
11
    ...     ICommercialSubscription)
12
12
    >>> from lp.registry.interfaces.product import IProductSet
13
 
    >>> from lp.testing import login, ANONYMOUS
 
13
    >>> from canonical.launchpad.ftests import login, ANONYMOUS
14
14
    >>> login('no-priv@canonical.com')
15
15
 
16
16
An open source project should not have a commercial subscription,
25
25
attribute is correct.
26
26
 
27
27
    >>> owner = bzr.owner
28
 
    >>> owner.is_team
 
28
    >>> owner.isTeam()
29
29
    False
30
30
    >>> bzr.redeemSubscriptionVoucher('asdf123', owner, owner, 12, 'notes')
31
31
    >>> verifyObject(ICommercialSubscription, bzr.commercial_subscription)
37
37
 
38
38
Commercial subscriptions have zope.Public permissions for reading.
39
39
 
40
 
    >>> from lp.services.webapp.authorization import check_permission
 
40
    >>> from canonical.launchpad.webapp.authorization import check_permission
41
41
    >>> login(ANONYMOUS)
42
42
    >>> check_permission('zope.Public', bzr.commercial_subscription)
43
43
    True
371
371
as well as the license_info field. The results are ordered by date ceated
372
372
then display name.
373
373
 
374
 
    >>> from lp.services.database.sqlbase import flush_database_updates
 
374
    >>> from canonical.database.sqlbase import flush_database_updates
375
375
    >>> from datetime import timedelta
376
376
    >>> bzr.licenses = [License.GNU_GPL_V2, License.ECLIPSE]
377
377
    >>> flush_database_updates()
383
383
    Gnome Applets
384
384
    gnomebaker
385
385
 
386
 
The license_info field is also searched for matching search_text:
387
 
 
388
 
    >>> bzr.license_info = 'Code in /contrib is under a mit-like license.'
389
 
    >>> for product in product_set.forReview(search_text='mit'):
390
 
    ...     print product.name
391
 
    bzr
392
 
 
393
 
The whiteboard field is also searched for matching search_text:
394
 
 
395
 
    >>> from lp.testing import celebrity_logged_in
396
 
    >>> with celebrity_logged_in('registry_experts'):
397
 
    ...     bzr.reviewer_whiteboard = (
398
 
    ...         'cc-nc discriminates against commercial uses.')
399
 
    >>> for product in product_set.forReview(search_text='cc-nc'):
400
 
    ...     print product.name
401
 
    bzr
402
 
 
403
386
You can search for whether the product is active or not.
404
387
 
405
388
    >>> for product in product_set.forReview(active=False):
414
397
    python-gnome2-dev
415
398
    unassigned
416
399
    alsa-utils
 
400
    rosetta
417
401
    obsolete-junk
418
402
 
419
403
You can search for products by license. This will match products with
428
412
    ...     print product.name
429
413
    bzr
430
414
 
 
415
You can also search for projects that have zero licenses. This is also
 
416
convenient for searching for projects with at least one license.
 
417
 
 
418
    >>> for product in product_set.forReview(
 
419
    ...     has_zero_licenses=True, search_text='firefox|a52dec|bzr|derby'):
 
420
    ...     print product.name
 
421
    firefox
 
422
    a52dec
 
423
    >>> for product in product_set.forReview(
 
424
    ...     has_zero_licenses=False, search_text='firefox|a52dec|bzr|derby'):
 
425
    ...     print product.name
 
426
    bzr
 
427
    derby
 
428
 
 
429
You can search for products whose license_info field is empty or not empty.
 
430
This OR the licenses search field must match.
 
431
 
 
432
    >>> for product in product_set.forReview(license_info_is_empty=True):
 
433
    ...     print product.name
 
434
    tomcat
 
435
    python-gnome2-dev
 
436
    unassigned
 
437
    arch-mirrors
 
438
    firefox
 
439
    ...
 
440
    >>> for product in product_set.forReview(license_info_is_empty=False):
 
441
    ...     print product.name
 
442
    mega-money-maker
 
443
    obsolete-junk
 
444
    >>> for product in product_set.forReview(license_info_is_empty=False,
 
445
    ...                                      licenses=[License.GNU_GPL_V2]):
 
446
    ...     print product.name
 
447
    bzr
 
448
    mega-money-maker
 
449
    obsolete-junk
 
450
 
431
451
It is possible to search for problem project that have been reviewed, but
432
452
not approved
433
453
 
437
457
    python-gnome2-dev
438
458
    unassigned
439
459
    alsa-utils
 
460
    rosetta
440
461
 
441
462
You can search for products based on a date range in which the product
442
463
was created.
492
513
    ...     print product.name
493
514
    bzr
494
515
 
495
 
A reviewer can search for projects without a commercial subscription.
496
 
 
497
 
    >>> for product in product_set.forReview(
498
 
    ...     has_subscription=False, licenses=[License.OTHER_PROPRIETARY]):
499
 
    ...     print product.name
500
 
    mega-money-maker
501
 
 
502
516
You can search for products based on the date of that
503
517
its commercial subscription was modified, which only
504
518
happens when a voucher is redeemed.
522
536
    >>> product_set.forReview().count() == Product.select().count()
523
537
    True
524
538
 
 
539
The license_info_is_empty parameter only accepts True, False, or None.
 
540
 
 
541
    >>> product_set.forReview(license_info_is_empty='foo').count()
 
542
    Traceback (most recent call last):
 
543
    ...
 
544
    AssertionError...
 
545
 
525
546
The full text search will not match strings with dots in their name
526
547
but a clause is included to search specifically for the name.
527
548
 
560
581
    >>> registry_member = factory.makePerson()
561
582
    >>> registry = celebs.registry_experts
562
583
    >>> ignored = registry.addMember(registry_member, registry.teamowner)
 
584
    >>> logout()
563
585
 
564
586
    >>> login_person(registry_member)
565
587
    >>> check_permission('launchpad.Moderate', product_set)