Mercurial > mozilla > hg > licenser
annotate tests/doctest.txt @ 28:eb3749dbdbf5 default tip
finish web handler
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 25 Nov 2011 17:30:28 -0800 |
parents | d3e3a506dd29 |
children |
rev | line source |
---|---|
8 | 1 Test licenser |
2 ================ | |
3 | |
15 | 4 The obligatory imports:: |
8 | 5 |
6 >>> import licenser | |
18
c04a53145f19
interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
15
diff
changeset
|
7 >>> from licenser import licenses |
15 | 8 >>> import os |
8 | 9 |
18
c04a53145f19
interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
15
diff
changeset
|
10 Sanity check:: |
8 | 11 |
15 | 12 >>> assert os.path.exists(directory) |
24 | 13 >>> files = ['main.c', 'python_script.py'] |
14 >>> files = [os.path.join(directory, f) for f in files] | |
15 | 15 |
18
c04a53145f19
interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
15
diff
changeset
|
16 Test MPL license:: |
c04a53145f19
interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
15
diff
changeset
|
17 |
c04a53145f19
interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
15
diff
changeset
|
18 >>> license = licenses.MPL() |
24 | 19 >>> for f in files: |
20 ... license.has_license(f) | |
21 False | |
22 False | |
18
c04a53145f19
interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
15
diff
changeset
|
23 >>> variables = {'author': 'Jeff Hammel', 'email': 'k0s@k0s.org'} |
21
80193ae99aaf
fill out asterisk-style licenses
Jeff Hammel <jhammel@mozilla.com>
parents:
18
diff
changeset
|
24 >>> variables = license.obtain_variables(**variables) |
18
c04a53145f19
interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
15
diff
changeset
|
25 >>> license.interpolate(directory, variables) |
24 | 26 |
27 Assert files get licensed:: | |
28 | |
29 >>> for f in files: | |
30 ... license.has_license(f) | |
31 True | |
32 True |