Mercurial > p > roundup > code
annotate test.py @ 19:a5eb90ae8903
Fixed a bug in the filter
wrong variable names in the error message. Recognised that the filter
has an outstanding bug. Hrm. we need a bug tracker for this project :)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 20 Jul 2001 08:20:24 +0000 |
| parents | bb0572c92f23 |
| children |
| rev | line source |
|---|---|
|
18
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1 |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 import pprint |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 db = Database("test_db", "richard") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 status = Class(db, "status", name=String()) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 status.setkey("name") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 print db.status.create(name="unread") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 print db.status.create(name="in-progress") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 print db.status.create(name="testing") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 print db.status.create(name="resolved") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 print db.status.count() |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 print db.status.list() |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 print db.status.lookup("in-progress") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 db.status.retire(3) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 print db.status.list() |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 issue = Class(db, "issue", title=String(), status=Link("status")) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 db.issue.create(title="spam", status=1) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 db.issue.create(title="eggs", status=2) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
18 db.issue.create(title="ham", status=4) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 db.issue.create(title="arguments", status=2) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 db.issue.create(title="abuse", status=1) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 user = Class(db, "user", username=String(), password=String()) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 user.setkey("username") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 db.issue.addprop(fixer=Link("user")) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 print db.issue.getprops() |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
25 #{"title": <hyperdb.String>, "status": <hyperdb.Link to "status">, |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
26 #"user": <hyperdb.Link to "user">} |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
27 db.issue.set(5, status=2) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
28 print db.issue.get(5, "status") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 print db.status.get(2, "name") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
30 print db.issue.get(5, "title") |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
31 print db.issue.find(status = db.status.lookup("in-progress")) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
32 print db.issue.history(5) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 # [(<Date 2000-06-28.19:09:43>, "ping", "create", {"title": "abuse", "status": 1}), |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 # (<Date 2000-06-28.19:11:04>, "ping", "set", {"status": 2})] |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 print db.status.history(1) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 # [(<Date 2000-06-28.19:09:43>, "ping", "link", ("issue", 5, "status")), |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 # (<Date 2000-06-28.19:11:04>, "ping", "unlink", ("issue", 5, "status"))] |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
38 print db.status.history(2) |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 # [(<Date 2000-06-28.19:11:04>, "ping", "link", ("issue", 5, "status"))] |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 |
|
bb0572c92f23
largish changes as a start of splitting off bits and pieces...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 # TODO: set up some filter tests |
