annotate tests/doctest.txt @ 27:7e0c931a201d

web licenser now works
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 25 Nov 2011 00:57:38 -0800
parents d3e3a506dd29
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
c3c65fb15ab3 stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 Test licenser
c3c65fb15ab3 stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 ================
c3c65fb15ab3 stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
15
cf920f85fb98 more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
4 The obligatory imports::
8
c3c65fb15ab3 stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
c3c65fb15ab3 stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
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
cf920f85fb98 more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
8 >>> import os
8
c3c65fb15ab3 stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9
18
c04a53145f19 interpolate the files, i hope
Jeff Hammel <jhammel@mozilla.com>
parents: 15
diff changeset
10 Sanity check::
8
c3c65fb15ab3 stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11
15
cf920f85fb98 more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
12 >>> assert os.path.exists(directory)
24
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
13 >>> files = ['main.c', 'python_script.py']
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
14 >>> files = [os.path.join(directory, f) for f in files]
15
cf920f85fb98 more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
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
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
19 >>> for f in files:
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
20 ... license.has_license(f)
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
21 False
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
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
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
26
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
27 Assert files get licensed::
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
28
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
29 >>> for f in files:
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
30 ... license.has_license(f)
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
31 True
d3e3a506dd29 tests now pass
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
32 True