2007-09-26 23:49:27 +00:00
|
|
|
import re
|
2007-07-16 20:22:38 +00:00
|
|
|
import cherrypy
|
2007-09-26 23:49:27 +00:00
|
|
|
import smtplib
|
2008-01-15 00:36:19 +00:00
|
|
|
import urllib
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
from pytz import utc
|
2007-10-16 21:37:12 +00:00
|
|
|
from nose.tools import raises
|
2007-09-26 23:49:27 +00:00
|
|
|
from datetime import datetime, timedelta
|
2007-07-16 20:22:38 +00:00
|
|
|
from Test_controller import Test_controller
|
2008-01-15 00:36:19 +00:00
|
|
|
import Stub_urllib2
|
2008-09-11 07:36:12 +00:00
|
|
|
from config.Version import VERSION
|
2007-10-11 19:49:00 +00:00
|
|
|
from model.User import User
|
2008-05-29 23:36:14 +00:00
|
|
|
from model.Group import Group
|
2007-10-11 19:49:00 +00:00
|
|
|
from model.Notebook import Notebook
|
|
|
|
from model.Note import Note
|
|
|
|
from model.Password_reset import Password_reset
|
2008-09-11 07:36:12 +00:00
|
|
|
from model.Download_access import Download_access
|
2007-12-18 00:05:13 +00:00
|
|
|
from model.Invite import Invite
|
2008-10-24 22:07:36 +00:00
|
|
|
from model.Tag import Tag
|
2008-01-15 00:36:19 +00:00
|
|
|
from controller.Users import Invite_error, Payment_error
|
|
|
|
import controller.Users as Users
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Test_users( Test_controller ):
|
2007-10-17 07:53:42 +00:00
|
|
|
RESET_LINK_PATTERN = re.compile( "(https?://\S+)?/r/(\S+)" )
|
2007-12-06 01:32:20 +00:00
|
|
|
INVITE_LINK_PATTERN = re.compile( "(https?://\S+)?/i/(\S+)" )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
def setUp( self ):
|
|
|
|
Test_controller.setUp( self )
|
2008-01-15 00:36:19 +00:00
|
|
|
Users.urllib2 = Stub_urllib2
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
self.username = u"mulder"
|
|
|
|
self.password = u"trustno1"
|
2007-12-11 01:15:03 +00:00
|
|
|
self.email_address = u"out-there@example.com"
|
2007-07-16 20:22:38 +00:00
|
|
|
self.new_username = u"reynolds"
|
|
|
|
self.new_password = u"shiny"
|
|
|
|
self.new_email_address = u"capn@example.com"
|
2007-09-26 23:49:27 +00:00
|
|
|
self.username2 = u"scully"
|
|
|
|
self.password2 = u"trustsome1"
|
2007-12-11 01:15:03 +00:00
|
|
|
self.email_address2 = u"out-there@example.com"
|
2007-07-16 20:22:38 +00:00
|
|
|
self.user = None
|
2007-09-26 23:49:27 +00:00
|
|
|
self.user2 = None
|
2008-11-04 18:29:19 +00:00
|
|
|
self.demo_user = None
|
2008-05-29 23:36:14 +00:00
|
|
|
self.group = None
|
|
|
|
self.group2 = None
|
2007-07-16 20:22:38 +00:00
|
|
|
self.anonymous = None
|
|
|
|
self.notebooks = None
|
2007-12-06 01:32:20 +00:00
|
|
|
self.session_id = None
|
2007-07-16 20:22:38 +00:00
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
self.make_users()
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
def make_users( self ):
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
notebook_id1 = self.database.next_id( Notebook )
|
|
|
|
notebook_id2 = self.database.next_id( Notebook )
|
|
|
|
trash_id1 = self.database.next_id( Notebook )
|
|
|
|
trash_id2 = self.database.next_id( Notebook )
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-12-27 22:16:47 +00:00
|
|
|
self.database.save( Notebook.create( trash_id1, u"trash" ) )
|
|
|
|
self.database.save( Notebook.create( trash_id2, u"trash" ) )
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
self.notebooks = [
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
Notebook.create( notebook_id1, u"my notebook", trash_id = trash_id1 ),
|
|
|
|
Notebook.create( notebook_id2, u"my other notebook", trash_id = trash_id2 ),
|
2007-07-16 20:22:38 +00:00
|
|
|
]
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
self.database.save( self.notebooks[ 0 ] )
|
|
|
|
self.database.save( self.notebooks[ 1 ] )
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address )
|
|
|
|
self.database.save( self.user, commit = False )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
self.anon_notebook = Notebook.create( self.database.next_id( Notebook ), u"anon notebook" )
|
|
|
|
self.database.save( self.anon_notebook )
|
|
|
|
self.startup_note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>login</h3>",
|
|
|
|
notebook_id = self.anon_notebook.object_id, startup = True,
|
2008-10-24 18:51:19 +00:00
|
|
|
user_id = self.user.object_id,
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
)
|
2008-10-24 18:51:19 +00:00
|
|
|
self.database.save( self.startup_note, commit = False )
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
|
2008-05-29 23:36:14 +00:00
|
|
|
self.group = Group.create( self.database.next_id( Group ), u"my group" )
|
|
|
|
self.database.save( self.group, commit = False )
|
|
|
|
self.group2 = Group.create( self.database.next_id( Group ), u"other group" )
|
|
|
|
self.database.save( self.group2, commit = False )
|
|
|
|
|
2008-03-15 03:04:59 +00:00
|
|
|
self.database.execute( self.user.sql_save_notebook( notebook_id1, read_write = True, owner = True, rank = 0 ), commit = False )
|
2007-12-30 01:20:38 +00:00
|
|
|
self.database.execute( self.user.sql_save_notebook( trash_id1, read_write = True, owner = True ), commit = False )
|
2008-03-15 03:04:59 +00:00
|
|
|
self.database.execute( self.user.sql_save_notebook( notebook_id2, read_write = True, owner = True, rank = 1 ), commit = False )
|
2007-12-30 01:20:38 +00:00
|
|
|
self.database.execute( self.user.sql_save_notebook( trash_id2, read_write = True, owner = True ), commit = False )
|
2008-05-29 23:36:14 +00:00
|
|
|
self.database.execute( self.user.sql_save_group( self.group.object_id, admin = False ) )
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
|
2008-06-06 23:14:44 +00:00
|
|
|
self.user2 = User.create( self.database.next_id( User ), self.username2, self.password2, self.email_address2, rate_plan = 1 )
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
self.database.save( self.user2, commit = False )
|
2008-05-29 23:36:14 +00:00
|
|
|
self.database.execute( self.user2.sql_save_group( self.group.object_id, admin = True ) )
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
|
|
|
|
self.anonymous = User.create( self.database.next_id( User ), u"anonymous" )
|
|
|
|
self.database.save( self.anonymous, commit = False )
|
2008-08-19 21:22:40 +00:00
|
|
|
self.database.execute( self.anonymous.sql_save_notebook( self.anon_notebook.object_id, read_write = False, owner = False ), commit = False )
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
self.demo_user = User.create( self.database.next_id( User ), username = None )
|
|
|
|
self.database.save( self.demo_user, commit = False )
|
|
|
|
self.database.execute( self.demo_user.sql_save_notebook( notebook_id1, read_write = True, owner = False, own_notes_only = True ), commit = False )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
self.database.commit()
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
def test_signup( self ):
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
signup_button = u"sign up",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ].startswith( u"/notebooks/" )
|
|
|
|
|
2008-03-24 22:33:00 +00:00
|
|
|
def test_signup_with_rate_plan( self ):
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
signup_button = u"sign up",
|
|
|
|
rate_plan = u"2",
|
|
|
|
) )
|
|
|
|
|
2008-05-08 19:14:39 +00:00
|
|
|
assert result[ u"redirect" ] == u"/users/subscribe?rate_plan=2&yearly=False"
|
|
|
|
|
|
|
|
def test_signup_with_rate_plan_and_yearly( self ):
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
signup_button = u"sign up",
|
|
|
|
rate_plan = u"2",
|
|
|
|
yearly = True,
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ] == u"/users/subscribe?rate_plan=2&yearly=True"
|
2008-03-24 22:33:00 +00:00
|
|
|
|
2007-11-04 19:09:48 +00:00
|
|
|
def test_signup_without_email_address( self ):
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = u"",
|
|
|
|
signup_button = u"sign up",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ].startswith( u"/notebooks/" )
|
|
|
|
|
|
|
|
def test_signup_with_invalid_email_address( self ):
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = u"foo@",
|
|
|
|
signup_button = u"sign up",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"error" in result
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
def __get_recent_user( self ):
|
|
|
|
return self.database.select_one( User, "select * from luminotes_user order by revision desc limit 1;" );
|
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
def test_current_after_signup( self ):
|
2007-07-16 20:22:38 +00:00
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
signup_button = u"sign up",
|
|
|
|
) )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
new_notebook_id = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
user = self.__get_recent_user()
|
2007-10-16 21:37:12 +00:00
|
|
|
assert isinstance( user, User )
|
|
|
|
result = cherrypy.root.users.current( user.object_id )
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
assert result[ u"user" ].object_id == user.object_id
|
2007-07-16 20:22:38 +00:00
|
|
|
assert result[ u"user" ].username == self.new_username
|
2007-10-16 21:37:12 +00:00
|
|
|
assert result[ u"user" ].email_address == self.new_email_address
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
notebooks = result[ u"notebooks" ]
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( notebooks ) == 1
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
notebook = notebooks[ 0 ]
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.object_id == new_notebook_id
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert notebook.revision
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.name == u"my notebook"
|
|
|
|
assert notebook.trash_id
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2007-12-04 21:28:03 +00:00
|
|
|
assert notebook.owner == True
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.rank == 0
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
assert result.get( u"login_url" ) is None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2007-08-27 22:37:22 +00:00
|
|
|
|
2007-09-20 20:36:19 +00:00
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2007-09-20 20:36:19 +00:00
|
|
|
|
2008-05-28 23:05:38 +00:00
|
|
|
assert result[ u"groups" ] == []
|
|
|
|
|
2007-12-27 22:16:47 +00:00
|
|
|
def test_current_after_signup_with_invite_id( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
signup_button = u"sign up",
|
|
|
|
invite_id = invite_id,
|
|
|
|
) )
|
|
|
|
|
|
|
|
invite_notebook_id = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
assert invite_notebook_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
user = self.__get_recent_user()
|
2007-12-27 22:16:47 +00:00
|
|
|
assert isinstance( user, User )
|
|
|
|
result = cherrypy.root.users.current( user.object_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].object_id == user.object_id
|
|
|
|
assert result[ u"user" ].username == self.new_username
|
|
|
|
assert result[ u"user" ].email_address == self.new_email_address
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert cherrypy.root.users.load_notebook( user.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert cherrypy.root.users.load_notebook( user.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-27 22:16:47 +00:00
|
|
|
|
|
|
|
# the notebook that the user was invited to should be in the list of returned notebooks
|
|
|
|
notebooks = dict( [ ( notebook.object_id, notebook ) for notebook in result[ u"notebooks" ] ] )
|
|
|
|
|
|
|
|
notebook = notebooks.get( invite_notebook_id )
|
|
|
|
assert notebook
|
|
|
|
assert notebook.revision
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
|
|
|
assert notebook.trash_id
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_ONLY
|
2007-12-27 22:16:47 +00:00
|
|
|
assert notebook.owner == False
|
2008-03-15 03:04:59 +00:00
|
|
|
assert notebook.rank == 1
|
2007-12-27 22:16:47 +00:00
|
|
|
|
|
|
|
assert result.get( u"login_url" ) is None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2007-12-27 22:16:47 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2007-12-27 22:16:47 +00:00
|
|
|
|
2008-05-28 23:05:38 +00:00
|
|
|
assert result[ u"groups" ] == []
|
|
|
|
|
2008-03-24 22:33:00 +00:00
|
|
|
def test_current_after_signup_with_rate_plan( self ):
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
signup_button = u"sign up",
|
|
|
|
rate_plan = u"2",
|
|
|
|
) )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
2008-05-08 19:14:39 +00:00
|
|
|
assert result[ u"redirect" ] == u"/users/subscribe?rate_plan=2&yearly=False"
|
2008-03-24 22:33:00 +00:00
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
user = self.__get_recent_user()
|
2008-03-24 22:33:00 +00:00
|
|
|
assert isinstance( user, User )
|
|
|
|
result = cherrypy.root.users.current( user.object_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].object_id == user.object_id
|
|
|
|
assert result[ u"user" ].username == self.new_username
|
|
|
|
assert result[ u"user" ].email_address == self.new_email_address
|
|
|
|
|
|
|
|
notebooks = result[ u"notebooks" ]
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( notebooks ) == 1
|
2008-03-24 22:33:00 +00:00
|
|
|
notebook = notebooks[ 0 ]
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.object_id
|
2008-03-24 22:33:00 +00:00
|
|
|
assert notebook.revision
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.name == u"my notebook"
|
|
|
|
assert notebook.trash_id
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-03-24 22:33:00 +00:00
|
|
|
assert notebook.owner == True
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.rank == 0
|
2008-03-24 22:33:00 +00:00
|
|
|
|
|
|
|
assert result.get( u"login_url" ) is None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
2008-05-28 23:05:38 +00:00
|
|
|
assert result[ u"groups" ] == []
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
def test_signup_with_different_passwords( self ):
|
|
|
|
result = self.http_post( "/users/signup", dict(
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password + u"nomatch",
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
signup_button = u"sign up",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
|
2008-06-06 23:14:44 +00:00
|
|
|
def test_signup_group_member( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"created" in result[ u"message" ]
|
|
|
|
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user
|
|
|
|
assert user.username == self.new_username
|
|
|
|
assert user.email_address == self.new_email_address
|
|
|
|
assert user.storage_bytes == 0
|
|
|
|
assert user.group_storage_bytes == 0
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
|
|
|
membership = cherrypy.root.users.check_group( user.object_id, self.group.object_id )
|
|
|
|
assert membership is True
|
|
|
|
|
|
|
|
def test_signup_group_member_without_access( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group2.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_without_admin_access( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_without_login( self ):
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_with_invalid_rate_plan( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
self.user2.rate_plan = 17
|
|
|
|
self.database.save( self.user2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_without_user_admin_rate_plan( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
self.user2.rate_plan = 0
|
|
|
|
self.database.save( self.user2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_without_user_admin_rate_plan( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
self.user2.rate_plan = 0
|
|
|
|
self.database.save( self.user2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_without_included_users_in_rate_plan( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
del( self.settings[ u"global" ][ u"luminotes.rate_plans"][ 1 ][ u"included_users" ] )
|
|
|
|
|
|
|
|
# first successfully create a group member
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_with_unknown_group( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
# first successfully create a group member
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = u"unknowngroupid",
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( self.new_username ) )
|
|
|
|
assert user is None
|
|
|
|
|
|
|
|
def test_signup_group_member_with_too_many_users( self ):
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
# first successfully create a group member
|
|
|
|
self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = self.new_username,
|
|
|
|
password = self.new_password,
|
|
|
|
password_repeat = self.new_password,
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# then create another, going over the limit of the rate plan's included_users
|
|
|
|
result = self.http_post( "/users/signup_group_member", dict(
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
username = u"kaylee",
|
|
|
|
password = u"reallyshiny",
|
|
|
|
password_repeat = u"reallyshiny",
|
|
|
|
email_address = u"mechanic@example.com",
|
|
|
|
create_user_button = u"create member",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"additional users" in result[ "error" ]
|
|
|
|
user = self.database.select_one( User, User.sql_load_by_username( u"kaylee" ) )
|
|
|
|
assert user is None
|
|
|
|
|
2008-03-24 22:33:00 +00:00
|
|
|
def test_subscribe( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/subscribe", dict(
|
|
|
|
rate_plan = u"1",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
form = result.get( u"form" )
|
|
|
|
plan = self.settings[ u"global" ][ u"luminotes.rate_plans" ][ 1 ]
|
|
|
|
|
2009-01-02 00:54:55 +00:00
|
|
|
assert form == plan[ u"button" ] % ( self.user.object_id, 0 )
|
2008-03-24 22:33:00 +00:00
|
|
|
|
2008-05-08 19:14:39 +00:00
|
|
|
def test_subscribe_yearly( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/subscribe", dict(
|
|
|
|
rate_plan = u"1",
|
|
|
|
yearly = True,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
form = result.get( u"form" )
|
|
|
|
plan = self.settings[ u"global" ][ u"luminotes.rate_plans" ][ 1 ]
|
|
|
|
|
2009-01-02 00:54:55 +00:00
|
|
|
assert form == plan[ u"yearly_button" ] % ( self.user.object_id, 0 )
|
2008-05-08 19:14:39 +00:00
|
|
|
|
2008-03-24 22:33:00 +00:00
|
|
|
def test_subscribe_with_free_rate_plan( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/subscribe", dict(
|
|
|
|
rate_plan = u"0",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"plan" in result[ u"error" ]
|
|
|
|
assert u"invalid" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_subscribe_with_invalid_rate_plan( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/subscribe", dict(
|
|
|
|
rate_plan = u"17",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"plan" in result[ u"error" ]
|
|
|
|
assert u"invalid" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_subscribe_without_login( self ):
|
|
|
|
result = self.http_post( "/users/subscribe", dict(
|
|
|
|
rate_plan = u"1",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"user" in result[ u"error" ]
|
|
|
|
assert u"invalid" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_subscribe_without_subscribe_button( self ):
|
|
|
|
self.login()
|
|
|
|
self.settings[ u"global" ][ u"luminotes.rate_plans" ][ 1 ][ u"button" ] = u" "
|
|
|
|
|
|
|
|
result = self.http_post( "/users/subscribe", dict(
|
|
|
|
rate_plan = u"1",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"not configured" in result[ u"error" ]
|
|
|
|
|
2007-09-28 23:54:19 +00:00
|
|
|
def test_demo( self ):
|
|
|
|
result = self.http_post( "/users/demo", dict() )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ].startswith( u"/notebooks/" )
|
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
def test_current_after_demo( self ):
|
2007-09-28 23:54:19 +00:00
|
|
|
result = self.http_post( "/users/demo", dict() )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
new_notebook_id = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
user = self.__get_recent_user()
|
2007-10-16 21:37:12 +00:00
|
|
|
assert isinstance( user, User )
|
|
|
|
result = cherrypy.root.users.current( user.object_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].object_id == user.object_id
|
|
|
|
assert result[ u"user" ].username is None
|
|
|
|
assert result[ u"user" ].email_address is None
|
2007-09-28 23:54:19 +00:00
|
|
|
|
|
|
|
notebooks = result[ u"notebooks" ]
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( notebooks ) == 1
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
|
2008-11-18 07:38:22 +00:00
|
|
|
notebook = notebooks[ 0 ]
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.object_id == new_notebook_id
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert notebook.revision
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.name == u"my notebook"
|
|
|
|
assert notebook.trash_id
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2007-12-04 21:28:03 +00:00
|
|
|
assert notebook.owner == True
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.rank == 0
|
2007-09-28 23:54:19 +00:00
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
assert result.get( u"login_url" ) is None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2007-09-28 23:54:19 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2007-09-28 23:54:19 +00:00
|
|
|
|
2008-05-28 23:05:38 +00:00
|
|
|
assert result[ u"groups" ] == []
|
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
def test_current_after_demo_twice( self ):
|
2007-09-28 23:54:19 +00:00
|
|
|
result = self.http_post( "/users/demo", dict() )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
new_notebook_id = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
user = self.__get_recent_user()
|
2007-10-16 21:37:12 +00:00
|
|
|
assert isinstance( user, User )
|
|
|
|
result = cherrypy.root.users.current( user.object_id )
|
2007-09-28 23:54:19 +00:00
|
|
|
|
|
|
|
user_id = result[ u"user" ].object_id
|
2007-10-16 21:37:12 +00:00
|
|
|
assert user_id == user.object_id
|
2007-09-28 23:54:19 +00:00
|
|
|
|
|
|
|
# request a demo for a second time
|
|
|
|
result = self.http_post( "/users/demo", dict(), session_id = session_id )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ].startswith( u"/notebooks/" )
|
|
|
|
notebook_id_again = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
|
|
|
|
assert notebook_id_again == new_notebook_id
|
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
result = cherrypy.root.users.current( user_id )
|
2007-09-28 23:54:19 +00:00
|
|
|
|
|
|
|
user_id_again = result[ u"user" ].object_id
|
|
|
|
|
|
|
|
# since we're already logged in as a guest user with a demo notebook, requesting a demo again
|
|
|
|
# should just use the same guest user with the same notebook
|
|
|
|
assert user_id_again == user_id
|
|
|
|
|
2007-07-16 20:22:38 +00:00
|
|
|
def test_login( self ):
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = self.username,
|
|
|
|
password = self.password,
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ] == u"/notebooks/%s" % self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_login_with_unknown_user( self ):
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = u"nosuchuser",
|
|
|
|
password = self.password,
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
|
|
|
|
def test_login_with_invalid_password( self ):
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = self.username,
|
|
|
|
password = u"wrongpass",
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
|
|
|
|
def test_logout( self ):
|
|
|
|
result = self.http_post( "/users/logout", dict() )
|
|
|
|
|
2007-08-02 18:57:53 +00:00
|
|
|
assert result[ u"redirect" ] == self.settings[ u"global" ].get( u"luminotes.http_url" ) + u"/"
|
2007-07-16 20:22:38 +00:00
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
def test_current( self ):
|
|
|
|
result = cherrypy.root.users.current( self.user.object_id )
|
2007-07-16 20:22:38 +00:00
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert result[ u"user" ]
|
|
|
|
assert result[ u"user" ].object_id == self.user.object_id
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-11-18 07:38:22 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert result[ u"notebooks" ][ 0 ].name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].read_write == Notebook.READ_WRITE
|
2007-12-04 21:28:03 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].owner == True
|
2008-11-18 07:38:22 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].rank == 0
|
2008-10-24 22:07:36 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].tags == []
|
2008-11-18 07:38:22 +00:00
|
|
|
assert result[ u"notebooks" ][ 1 ].object_id == self.notebooks[ 1 ].object_id
|
|
|
|
assert result[ u"notebooks" ][ 1 ].name == self.notebooks[ 1 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert result[ u"notebooks" ][ 1 ].read_write == Notebook.READ_WRITE
|
2007-12-04 21:28:03 +00:00
|
|
|
assert result[ u"notebooks" ][ 1 ].owner == True
|
2008-11-18 07:38:22 +00:00
|
|
|
assert result[ u"notebooks" ][ 1 ].rank == 1
|
2008-10-24 22:07:36 +00:00
|
|
|
assert result[ u"notebooks" ][ 1 ].tags == []
|
|
|
|
assert result[ u"login_url" ] is None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert result[ u"groups" ]
|
|
|
|
assert result[ u"groups" ][ 0 ].object_id == self.group.object_id
|
|
|
|
assert result[ u"groups" ][ 0 ].name == self.group.name
|
|
|
|
assert result[ u"groups" ][ 0 ].admin == False
|
|
|
|
|
|
|
|
def test_current_with_tags( self ):
|
|
|
|
tag_id = self.database.next_id( Tag, commit = False )
|
|
|
|
new_tag = Tag.create(
|
|
|
|
tag_id,
|
|
|
|
notebook_id = None, # this tag is not in the namespace of a single notebook
|
|
|
|
user_id = self.anonymous.object_id,
|
|
|
|
name = u"mytag",
|
|
|
|
description = u"some tag"
|
|
|
|
)
|
|
|
|
self.database.save( new_tag, commit = False )
|
|
|
|
self.database.execute(
|
|
|
|
self.user.sql_save_notebook_tag( self.notebooks[ 0 ].object_id, new_tag.object_id, value = u"myvalue" ),
|
|
|
|
commit = False,
|
|
|
|
)
|
|
|
|
|
|
|
|
tag_id2 = self.database.next_id( Tag, commit = False )
|
|
|
|
new_tag2 = Tag.create(
|
|
|
|
tag_id2,
|
|
|
|
notebook_id = None, # this tag is not in the namespace of a single notebook
|
|
|
|
user_id = self.user.object_id,
|
|
|
|
name = u"mytag2",
|
|
|
|
description = u"some tag 2"
|
|
|
|
)
|
|
|
|
self.database.save( new_tag2, commit = False )
|
|
|
|
self.database.execute(
|
|
|
|
self.user.sql_save_notebook_tag( self.notebooks[ 0 ].object_id, new_tag2.object_id, value = u"myvalue2" ),
|
|
|
|
commit = False,
|
|
|
|
)
|
|
|
|
|
|
|
|
self.database.commit()
|
|
|
|
|
|
|
|
result = cherrypy.root.users.current( self.user.object_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ]
|
|
|
|
assert result[ u"user" ].object_id == self.user.object_id
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-11-18 07:38:22 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert result[ u"notebooks" ][ 0 ].name == self.notebooks[ 0 ].name
|
2008-10-24 22:07:36 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].read_write == Notebook.READ_WRITE
|
|
|
|
assert result[ u"notebooks" ][ 0 ].owner == True
|
2008-11-18 07:38:22 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].rank == 0
|
|
|
|
assert result[ u"notebooks" ][ 0 ].tags
|
|
|
|
assert len( result[ u"notebooks" ][ 0 ].tags ) == 2
|
|
|
|
|
|
|
|
tags = result[ u"notebooks" ][ 0 ].tags
|
2008-10-24 22:07:36 +00:00
|
|
|
assert tags[ 0 ].object_id == new_tag.object_id
|
|
|
|
assert tags[ 0 ].notebook_id == new_tag.notebook_id
|
|
|
|
assert tags[ 0 ].user_id == new_tag.user_id
|
|
|
|
assert tags[ 0 ].name == new_tag.name
|
|
|
|
assert tags[ 0 ].description == new_tag.description
|
|
|
|
assert tags[ 1 ].object_id == new_tag2.object_id
|
|
|
|
assert tags[ 1 ].notebook_id == new_tag2.notebook_id
|
|
|
|
assert tags[ 1 ].user_id == new_tag2.user_id
|
|
|
|
assert tags[ 1 ].name == new_tag2.name
|
|
|
|
assert tags[ 1 ].description == new_tag2.description
|
|
|
|
|
2008-11-18 07:38:22 +00:00
|
|
|
assert result[ u"notebooks" ][ 1 ].object_id == self.notebooks[ 1 ].object_id
|
|
|
|
assert result[ u"notebooks" ][ 1 ].name == self.notebooks[ 1 ].name
|
|
|
|
assert result[ u"notebooks" ][ 1 ].read_write == Notebook.READ_WRITE
|
|
|
|
assert result[ u"notebooks" ][ 1 ].owner == True
|
|
|
|
assert result[ u"notebooks" ][ 1 ].rank == 1
|
|
|
|
assert result[ u"notebooks" ][ 1 ].tags == []
|
2007-10-16 21:37:12 +00:00
|
|
|
assert result[ u"login_url" ] is None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2007-10-16 21:37:12 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2007-10-16 21:37:12 +00:00
|
|
|
|
2008-05-29 23:36:14 +00:00
|
|
|
assert result[ u"groups" ]
|
|
|
|
assert result[ u"groups" ][ 0 ].object_id == self.group.object_id
|
|
|
|
assert result[ u"groups" ][ 0 ].name == self.group.name
|
|
|
|
assert result[ u"groups" ][ 0 ].admin == False
|
2008-05-28 23:05:38 +00:00
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
def test_current_anonymous( self ):
|
|
|
|
result = cherrypy.root.users.current( self.anonymous.object_id )
|
2007-07-16 20:22:38 +00:00
|
|
|
|
|
|
|
assert result[ u"user" ].username == "anonymous"
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 1
|
|
|
|
assert result[ u"notebooks" ][ 0 ].object_id == self.anon_notebook.object_id
|
|
|
|
assert result[ u"notebooks" ][ 0 ].name == self.anon_notebook.name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].read_write == Notebook.READ_ONLY
|
2007-12-04 21:28:03 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].owner == False
|
2008-03-15 03:04:59 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].rank == None
|
2007-08-27 22:37:22 +00:00
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
login_note = self.database.select_one( Note, self.anon_notebook.sql_load_note_by_title( u"login" ) )
|
2007-08-30 23:57:56 +00:00
|
|
|
assert result[ u"login_url" ] == u"%s/notebooks/%s?note_id=%s" % (
|
|
|
|
self.settings[ u"global" ][ u"luminotes.https_url" ],
|
|
|
|
self.anon_notebook.object_id,
|
|
|
|
login_note.object_id,
|
|
|
|
)
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2007-08-30 23:57:56 +00:00
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2007-09-12 22:42:46 +00:00
|
|
|
|
2008-05-28 23:05:38 +00:00
|
|
|
assert result[ u"groups" ] == []
|
|
|
|
|
2008-03-15 03:04:59 +00:00
|
|
|
def test_login_with_invite_id( self ):
|
2007-12-27 22:16:47 +00:00
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = self.username2,
|
|
|
|
password = self.password2,
|
|
|
|
invite_id = invite_id,
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
|
|
|
|
invite_notebook_id = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
assert invite_notebook_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-27 22:16:47 +00:00
|
|
|
|
2008-03-15 03:04:59 +00:00
|
|
|
def test_login_with_after_login( self ):
|
2008-01-10 08:33:19 +00:00
|
|
|
after_login = u"/foo/bar"
|
|
|
|
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = self.username2,
|
|
|
|
password = self.password2,
|
|
|
|
after_login = after_login,
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ] == after_login
|
|
|
|
|
2008-03-15 03:04:59 +00:00
|
|
|
def test_login_with_after_login_with_full_url( self ):
|
2008-01-10 08:33:19 +00:00
|
|
|
after_login = u"http://this_url/does/not/start/with/a/slash"
|
|
|
|
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = self.username2,
|
|
|
|
password = self.password2,
|
|
|
|
after_login = after_login,
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"redirect" ] == u"/"
|
|
|
|
|
2007-09-13 00:53:49 +00:00
|
|
|
def test_update_storage( self ):
|
|
|
|
previous_revision = self.user.revision
|
|
|
|
|
2007-09-20 20:36:19 +00:00
|
|
|
cherrypy.root.users.update_storage( self.user.object_id )
|
2007-09-13 00:53:49 +00:00
|
|
|
|
|
|
|
expected_size = cherrypy.root.users.calculate_storage( self.user )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.storage_bytes == expected_size
|
2008-06-05 21:16:49 +00:00
|
|
|
assert user.group_storage_bytes == 0
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert user.revision > previous_revision
|
2007-09-20 20:36:19 +00:00
|
|
|
|
|
|
|
def test_update_storage_with_unknown_user_id( self ):
|
|
|
|
original_revision = self.user.revision
|
|
|
|
|
|
|
|
cherrypy.root.users.update_storage( 77 )
|
|
|
|
|
|
|
|
expected_size = cherrypy.root.users.calculate_storage( self.user )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
2007-09-20 20:36:19 +00:00
|
|
|
assert self.user.storage_bytes == 0
|
2008-06-05 21:16:49 +00:00
|
|
|
assert self.user.group_storage_bytes == 0
|
2007-09-20 20:36:19 +00:00
|
|
|
assert self.user.revision == original_revision
|
|
|
|
|
2008-08-19 01:00:45 +00:00
|
|
|
def test_update_storage_without_quota( self ):
|
|
|
|
self.settings[ u"global" ][ u"luminotes.rate_plans" ][ 0 ][ u"storage_bytes" ] = None
|
2008-08-19 21:22:40 +00:00
|
|
|
previous_revision = self.user.revision
|
2008-08-19 01:00:45 +00:00
|
|
|
|
|
|
|
cherrypy.root.users.update_storage( self.user.object_id )
|
|
|
|
|
|
|
|
expected_size = cherrypy.root.users.calculate_storage( self.user )
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
2008-08-19 21:22:40 +00:00
|
|
|
assert user.storage_bytes == expected_size
|
|
|
|
assert user.group_storage_bytes == 0
|
|
|
|
assert user.revision > previous_revision
|
2008-08-19 01:00:45 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_anonymous( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_demo( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_without_access( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_unknown_notebook( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, u"unknownid" )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook is None
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_unknown_user( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( u"unknownuser", self.notebooks[ 0 ].object_id )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook is None
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_read_write( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_read_write_anonymous( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_demo( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_without_access( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_own_notes( self ):
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-05 22:02:22 +00:00
|
|
|
def test_load_notebook_read_write_own_notes_inherit_anonymous( self ):
|
|
|
|
self.database.execute( self.anonymous.sql_save_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = True, owner = False, own_notes_only = True,
|
|
|
|
) )
|
|
|
|
self.database.execute( self.user.sql_remove_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_read_write_own_notes_anonymous( self ):
|
|
|
|
self.database.execute( self.anonymous.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_own_notes_demo( self ):
|
|
|
|
self.database.execute( self.demo_user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id, read_write = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_owner( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_owner_anonymous( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_owner_demo( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_owner_without_access( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_owner_own_notes( self ):
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-11-05 22:02:22 +00:00
|
|
|
def test_load_notebook_owner_own_notes_inherit_anonymous( self ):
|
|
|
|
self.database.execute( self.anonymous.sql_save_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = True, owner = False, own_notes_only = True,
|
|
|
|
) )
|
|
|
|
self.database.execute( self.user.sql_remove_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_owner_own_notes_anonymous( self ):
|
|
|
|
self.database.execute( self.anonymous.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_owner_own_notes_demo( self ):
|
|
|
|
self.database.execute( self.demo_user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_full( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_full_anonymous( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_full_demo( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_full_without_access( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_full_own_notes( self ):
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-11-05 22:02:22 +00:00
|
|
|
def test_load_notebook_full_own_notes_inherit_anonymous( self ):
|
|
|
|
self.database.execute( self.anonymous.sql_save_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = True, owner = False, own_notes_only = True,
|
|
|
|
) )
|
|
|
|
self.database.execute( self.user.sql_remove_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_full_own_notes_anonymous( self ):
|
|
|
|
self.database.execute( self.anonymous.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_full_own_notes_demo( self ):
|
|
|
|
self.database.execute( self.demo_user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id, read_write = True, owner = True )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_with_note_id_own_notes( self ):
|
2008-10-24 18:51:19 +00:00
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-05 22:02:22 +00:00
|
|
|
def test_load_notebook_with_note_id_own_notes_inherit_anonymous( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.anonymous.sql_save_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = True, owner = False, own_notes_only = True,
|
|
|
|
) )
|
|
|
|
self.database.execute( self.user.sql_remove_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_with_note_id_own_notes_anonymous( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.anonymous.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.anonymous.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_with_note_id_own_notes_demo( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.demo_user.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.demo_user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_with_note_id_own_notes_without_access( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user2.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_with_note_id_own_notes_by_another_user( self ):
|
2008-10-24 18:51:19 +00:00
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi from another user</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user2.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_with_unknown_note_id_own_notes( self ):
|
2008-10-24 18:51:19 +00:00
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = u"unknownid" )
|
|
|
|
|
2008-10-24 19:58:41 +00:00
|
|
|
# an unknown note id indicates that a new note is being created, which is allowed in a
|
|
|
|
# READ_WRITE_FOR_OWN_NOTES notebooks
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_with_stub_note_own_notes( self ):
|
2008-10-24 19:58:41 +00:00
|
|
|
# don't fully create a note, but reserve an id for it
|
|
|
|
note_id = self.database.next_id( Note )
|
|
|
|
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
2008-10-24 18:51:19 +00:00
|
|
|
|
2008-11-05 22:02:22 +00:00
|
|
|
def test_load_notebook_with_stub_note_own_notes_inherit_anonymous( self ):
|
|
|
|
# don't fully create a note, but reserve an id for it
|
|
|
|
note_id = self.database.next_id( Note )
|
|
|
|
|
|
|
|
self.database.execute( self.anonymous.sql_save_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = True, owner = False, own_notes_only = True,
|
|
|
|
) )
|
|
|
|
self.database.execute( self.user.sql_remove_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_with_stub_note_own_notes_anonymous( self ):
|
|
|
|
# don't fully create a note, but reserve an id for it
|
|
|
|
note_id = self.database.next_id( Note )
|
|
|
|
|
|
|
|
self.database.execute( self.anonymous.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_with_stub_note_own_notes_demo( self ):
|
|
|
|
# don't fully create a note, but reserve an id for it
|
|
|
|
note_id = self.database.next_id( Note )
|
|
|
|
|
|
|
|
self.database.execute( self.demo_user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_with_stub_note_own_notes_without_access( self ):
|
|
|
|
# don't fully create a note, but reserve an id for it
|
|
|
|
note_id = self.database.next_id( Note )
|
|
|
|
|
|
|
|
self.database.execute( self.user2.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_with_note_id_own_notes_in_another_notebook( self ):
|
2008-10-24 18:51:19 +00:00
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = self.startup_note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_with_note_id( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-05 22:02:22 +00:00
|
|
|
def test_load_notebook_read_write_with_note_id_inherit_anonymous( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.anonymous.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.anonymous.sql_save_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = True, owner = False,
|
|
|
|
) )
|
|
|
|
self.database.execute( self.user.sql_remove_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_read_write_with_note_id_anonymous( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.anonymous.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_with_note_id_demo( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.demo_user.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_with_note_id_without_access( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user2.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_read_write_with_note_id_by_another_user( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi from another user</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user2.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_with_unknown_note_id( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = u"unknownid" )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_read_write_with_note_id_in_another_notebook( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = self.startup_note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_read_only_with_note_id( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_ONLY, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-05 22:02:22 +00:00
|
|
|
def test_load_notebook_read_only_with_note_id_inherit_anonymous( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.anonymous.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.anonymous.sql_save_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = False, owner = False,
|
|
|
|
) )
|
|
|
|
self.database.execute( self.user.sql_remove_notebook(
|
|
|
|
self.notebooks[ 0 ].object_id
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
2008-11-04 18:29:19 +00:00
|
|
|
def test_load_notebook_read_only_with_note_id_anonymous( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.anonymous.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.anonymous.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_ONLY, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.anonymous.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
|
|
|
def test_load_notebook_read_only_with_note_id_demo( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.demo_user.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.demo_user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_ONLY, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.demo_user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_read_only_with_note_id_without_access( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user2.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.user2.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_ONLY, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook is None
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_read_only_with_note_id_by_another_user( self ):
|
|
|
|
note = Note.create(
|
|
|
|
self.database.next_id( Note ), u"<h3>hi from another user</h3>",
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
user_id = self.user2.object_id,
|
|
|
|
)
|
|
|
|
self.database.save( note )
|
|
|
|
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_ONLY, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_read_only_with_unknown_note_id( self ):
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_ONLY, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = u"unknownid" )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_read_only_with_note_id_in_another_notebook( self ):
|
|
|
|
self.database.execute( self.user.sql_update_access(
|
|
|
|
self.notebooks[ 0 ].object_id, read_write = Notebook.READ_ONLY, owner = False,
|
|
|
|
) )
|
|
|
|
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.notebooks[ 0 ].object_id,
|
|
|
|
note_id = self.startup_note.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_load_notebook_anon( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.anon_notebook.object_id )
|
|
|
|
|
|
|
|
assert notebook
|
|
|
|
assert notebook.object_id == self.anon_notebook.object_id
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_anon_read_write( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.anon_notebook.object_id, read_write = True )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook is None
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_anon_owner( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.anon_notebook.object_id, owner = True )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook is None
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
def test_load_notebook_anon_full( self ):
|
|
|
|
notebook = cherrypy.root.users.load_notebook( self.user.object_id, self.anon_notebook.object_id, read_write = True, owner = True )
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook is None
|
2007-12-04 21:28:03 +00:00
|
|
|
|
2008-05-29 23:36:14 +00:00
|
|
|
def test_check_group( self ):
|
|
|
|
membership = cherrypy.root.users.check_group( self.user.object_id, self.group.object_id )
|
|
|
|
|
|
|
|
assert membership is True
|
|
|
|
|
|
|
|
def test_check_group_with_admin( self ):
|
|
|
|
membership = cherrypy.root.users.check_group( self.user2.object_id, self.group.object_id )
|
|
|
|
|
|
|
|
assert membership is True
|
|
|
|
|
|
|
|
def test_check_group_anon( self ):
|
|
|
|
membership = cherrypy.root.users.check_group( self.anonymous.object_id, self.group.object_id )
|
|
|
|
|
|
|
|
assert membership is False
|
|
|
|
|
|
|
|
def test_check_group_without_membership( self ):
|
|
|
|
membership = cherrypy.root.users.check_group( self.user.object_id, self.group2.object_id )
|
|
|
|
|
|
|
|
assert membership is False
|
|
|
|
|
|
|
|
def test_check_group_without_user( self ):
|
|
|
|
membership = cherrypy.root.users.check_group( None, self.group2.object_id )
|
|
|
|
|
|
|
|
assert membership is False
|
|
|
|
|
|
|
|
def test_check_group_admin( self ):
|
|
|
|
membership = cherrypy.root.users.check_group( self.user.object_id, self.group.object_id, admin = True )
|
|
|
|
|
|
|
|
assert membership is False
|
|
|
|
|
|
|
|
def test_check_group_admin_with_admin( self ):
|
|
|
|
membership = cherrypy.root.users.check_group( self.user2.object_id, self.group.object_id, admin = True )
|
|
|
|
|
|
|
|
assert membership is True
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
def test_remove_group( self ):
|
2008-06-04 03:19:07 +00:00
|
|
|
self.login2()
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
2008-06-04 03:19:07 +00:00
|
|
|
result = self.http_post( "/users/remove_group", dict(
|
|
|
|
user_id_to_remove = self.user.object_id,
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"revoked" in result[ u"message" ]
|
|
|
|
assert cherrypy.root.users.check_group( self.user.object_id, self.group.object_id ) == False
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
|
|
|
def test_remove_group_without_access( self ):
|
2008-06-04 03:19:07 +00:00
|
|
|
self.login2()
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
2008-06-04 03:19:07 +00:00
|
|
|
result = self.http_post( "/users/remove_group", dict(
|
|
|
|
user_id_to_remove = self.user.object_id,
|
|
|
|
group_id = self.group2.object_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ u"error" ]
|
|
|
|
assert cherrypy.root.users.check_group( self.user.object_id, self.group.object_id ) == True
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
|
|
|
def test_remove_group_without_admin_access( self ):
|
2008-06-04 03:19:07 +00:00
|
|
|
self.login()
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
2008-06-04 03:19:07 +00:00
|
|
|
result = self.http_post( "/users/remove_group", dict(
|
|
|
|
user_id_to_remove = self.user.object_id,
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ u"error" ]
|
|
|
|
assert cherrypy.root.users.check_group( self.user.object_id, self.group.object_id ) == True
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
|
|
|
def test_remove_group_with_unknown_group( self ):
|
2008-06-04 03:19:07 +00:00
|
|
|
self.login2()
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
2008-06-04 03:19:07 +00:00
|
|
|
result = self.http_post( "/users/remove_group", dict(
|
|
|
|
user_id_to_remove = self.user.object_id,
|
|
|
|
group_id = u"unknowngroupid",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ u"error" ]
|
|
|
|
assert cherrypy.root.users.check_group( self.user.object_id, self.group.object_id ) == True
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
|
|
|
def test_remove_group_with_unknown_user( self ):
|
2008-06-04 03:19:07 +00:00
|
|
|
self.login2()
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
2008-06-04 03:19:07 +00:00
|
|
|
result = self.http_post( "/users/remove_group", dict(
|
|
|
|
user_id_to_remove = u"unknownuserid",
|
|
|
|
group_id = self.group.object_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"access" in result[ u"error" ]
|
|
|
|
assert cherrypy.root.users.check_group( self.user.object_id, self.group.object_id ) == True
|
|
|
|
|
2008-06-06 22:13:11 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2007-09-26 23:49:27 +00:00
|
|
|
def test_send_reset( self ):
|
|
|
|
result = self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
2007-09-28 20:20:55 +00:00
|
|
|
assert u"has been sent to" in result[ u"message" ]
|
2007-09-26 23:49:27 +00:00
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert "<%s>" % self.settings[ u"global" ][ u"luminotes.support_email" ] in smtplib.SMTP.from_address
|
|
|
|
assert smtplib.SMTP.to_addresses == [ self.user.email_address ]
|
|
|
|
assert u"password reset" in smtplib.SMTP.message
|
|
|
|
assert self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
|
|
|
|
def test_send_reset_to_unknown_email_address( self ):
|
|
|
|
result = self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = u"unknown@example.com",
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"no Luminotes user" in result[ u"error" ]
|
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert smtplib.SMTP.from_address == None
|
|
|
|
assert smtplib.SMTP.to_addresses == None
|
|
|
|
assert smtplib.SMTP.message == None
|
|
|
|
|
|
|
|
def test_redeem_reset( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
|
|
|
result = self.http_get( "/users/redeem_reset/%s" % password_reset_id )
|
|
|
|
|
2007-10-16 21:37:12 +00:00
|
|
|
assert result[ u"user" ].username == "anonymous"
|
|
|
|
assert len( result[ u"notebooks" ] ) == 1
|
|
|
|
assert result[ u"notebooks" ][ 0 ].object_id == self.anon_notebook.object_id
|
|
|
|
assert result[ u"notebooks" ][ 0 ].name == self.anon_notebook.name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].read_write == Notebook.READ_ONLY
|
2007-12-04 21:28:03 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].owner == False
|
2008-03-15 03:04:59 +00:00
|
|
|
assert result[ u"notebooks" ][ 0 ].rank == None
|
2007-10-16 21:37:12 +00:00
|
|
|
|
|
|
|
login_note = self.database.select_one( Note, self.anon_notebook.sql_load_note_by_title( u"login" ) )
|
|
|
|
assert result[ u"login_url" ] == u"%s/notebooks/%s?note_id=%s" % (
|
|
|
|
self.settings[ u"global" ][ u"luminotes.https_url" ],
|
|
|
|
self.anon_notebook.object_id,
|
|
|
|
login_note.object_id,
|
|
|
|
)
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2007-10-16 21:37:12 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2007-10-16 21:37:12 +00:00
|
|
|
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
2007-10-30 23:05:46 +00:00
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"complete your password reset"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"password reset" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert self.user.username in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert self.user2.username in result[ u"notes" ][ 0 ].contents
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
def test_redeem_reset_unknown( self ):
|
|
|
|
password_reset_id = u"unknownresetid"
|
|
|
|
result = self.http_get( "/users/redeem_reset/%s" % password_reset_id )
|
|
|
|
|
|
|
|
assert u"expired" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_redeem_reset_expired( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
2008-08-21 21:15:37 +00:00
|
|
|
# to trigger expiration, pretend that the password reset was made 26 hours ago
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
password_reset = self.database.load( Password_reset, password_reset_id )
|
2008-08-21 21:15:37 +00:00
|
|
|
password_reset._Persistent__revision = datetime.now( tz = utc ) - timedelta( hours = 26 )
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
self.database.save( password_reset )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
result = self.http_get( "/users/redeem_reset/%s" % password_reset_id )
|
|
|
|
|
|
|
|
assert u"expired" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_redeem_reset_already_redeemed( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
password_reset = self.database.load( Password_reset, password_reset_id )
|
|
|
|
password_reset.redeemed = True
|
|
|
|
self.database.save( password_reset )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
result = self.http_get( "/users/redeem_reset/%s" % password_reset_id )
|
|
|
|
|
|
|
|
assert u"already" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_redeem_reset_unknown_email( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
password_reset = self.database.load( Password_reset, password_reset_id )
|
|
|
|
password_reset._Password_reset__email_address = u"unknown@example.com"
|
|
|
|
self.database.save( password_reset )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
result = self.http_get( "/users/redeem_reset/%s" % password_reset_id )
|
|
|
|
|
|
|
|
assert u"email address" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_reset_password( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
|
|
|
new_password = u"newpass"
|
|
|
|
result = self.http_post( "/users/reset_password", (
|
|
|
|
( u"password_reset_id", password_reset_id ),
|
|
|
|
( u"reset_button", u"reset passwords" ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
) )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert result[ u"redirect" ]
|
2007-09-26 23:49:27 +00:00
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
# check that the password reset is now marked as redeemed
|
|
|
|
password_reset = self.database.load( Password_reset, password_reset_id )
|
|
|
|
assert password_reset.redeemed
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
# check that the password was actually reset for one of the users, but not the other
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.check_password( new_password )
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.check_password( self.password2 )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
def test_reset_password_unknown_reset_id( self ):
|
|
|
|
new_password = u"newpass"
|
|
|
|
password_reset_id = u"unknownresetid"
|
|
|
|
result = self.http_post( "/users/reset_password", (
|
|
|
|
( u"password_reset_id", password_reset_id ),
|
|
|
|
( u"reset_button", u"reset passwords" ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"expired" in result[ "error" ]
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
# check that neither user's password has changed
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.check_password( self.password )
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.check_password( self.password2 )
|
|
|
|
|
2007-09-26 23:49:27 +00:00
|
|
|
def test_reset_password_invalid_reset_id( self ):
|
|
|
|
new_password = u"newpass"
|
|
|
|
password_reset_id = u"invalid reset id"
|
|
|
|
result = self.http_post( "/users/reset_password", (
|
|
|
|
( u"password_reset_id", password_reset_id ),
|
|
|
|
( u"reset_button", u"reset passwords" ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"valid" in result[ "error" ]
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
# check that neither user's password has changed
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.check_password( self.password )
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.check_password( self.password2 )
|
|
|
|
|
2007-09-26 23:49:27 +00:00
|
|
|
def test_reset_password_expired( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
2008-08-21 21:15:37 +00:00
|
|
|
# to trigger expiration, pretend that the password reset was made 26 hours ago
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
password_reset = self.database.load( Password_reset, password_reset_id )
|
2008-08-21 21:15:37 +00:00
|
|
|
password_reset._Persistent__revision = datetime.now( tz = utc ) - timedelta( hours = 26 )
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
self.database.save( password_reset )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
new_password = u"newpass"
|
|
|
|
result = self.http_post( "/users/reset_password", (
|
|
|
|
( u"password_reset_id", password_reset_id ),
|
|
|
|
( u"reset_button", u"reset passwords" ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
) )
|
|
|
|
|
|
|
|
# check that the password reset is not marked as redeemed
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
password_reset = self.database.load( Password_reset, password_reset_id )
|
|
|
|
assert password_reset.redeemed == False
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
assert u"expired" in result[ "error" ]
|
|
|
|
|
|
|
|
# check that neither user's password has changed
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.check_password( self.password )
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.check_password( self.password2 )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
def test_reset_password_non_matching( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
|
|
|
new_password = u"newpass"
|
|
|
|
result = self.http_post( "/users/reset_password", (
|
|
|
|
( u"password_reset_id", password_reset_id ),
|
|
|
|
( u"reset_button", u"reset passwords" ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user.object_id, u"nonmatchingpass" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
) )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert u"password" in result[ "error" ]
|
|
|
|
|
2007-09-26 23:49:27 +00:00
|
|
|
# check that neither user's password has changed
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.check_password( self.password )
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.check_password( self.password2 )
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
def test_reset_password_blank( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
|
|
|
result = self.http_post( "/users/reset_password", (
|
|
|
|
( u"password_reset_id", password_reset_id ),
|
|
|
|
( u"reset_button", u"reset passwords" ),
|
|
|
|
( self.user.object_id, u"" ),
|
|
|
|
( self.user.object_id, u"" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
( self.user2.object_id, u"" ),
|
|
|
|
) )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert result[ "error" ]
|
|
|
|
|
2007-09-26 23:49:27 +00:00
|
|
|
# check that neither user's password has changed
|
|
|
|
assert self.user.check_password( self.password )
|
|
|
|
assert self.user2.check_password( self.password2 )
|
|
|
|
|
|
|
|
def test_reset_password_multiple_users( self ):
|
|
|
|
self.http_post( "/users/send_reset", dict(
|
|
|
|
email_address = self.user.email_address,
|
|
|
|
send_reset_button = u"email me",
|
|
|
|
) )
|
|
|
|
|
|
|
|
matches = self.RESET_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
password_reset_id = matches.group( 2 )
|
|
|
|
assert password_reset_id
|
|
|
|
|
|
|
|
new_password = u"newpass"
|
|
|
|
new_password2 = u"newpass2"
|
|
|
|
result = self.http_post( "/users/reset_password", (
|
|
|
|
( u"password_reset_id", password_reset_id ),
|
|
|
|
( u"reset_button", u"reset passwords" ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user.object_id, new_password ),
|
|
|
|
( self.user2.object_id, new_password2 ),
|
|
|
|
( self.user2.object_id, new_password2 ),
|
|
|
|
) )
|
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
assert result[ u"redirect" ]
|
2007-09-26 23:49:27 +00:00
|
|
|
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
# check that the password reset is now marked as redeemed
|
|
|
|
password_reset = self.database.load( Password_reset, password_reset_id )
|
|
|
|
assert password_reset.redeemed
|
2007-09-26 23:49:27 +00:00
|
|
|
|
|
|
|
# check that the password was actually reset for both users
|
Merged revisions 401-446 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/branches/postgres
................
r402 | witten | 2007-10-04 00:48:49 -0700 (Thu, 04 Oct 2007) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-401" from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
................
r404 | witten | 2007-10-04 01:17:07 -0700 (Thu, 04 Oct 2007) | 2 lines
Beginning a conversion from bsddb to postgres.
................
r405 | witten | 2007-10-04 01:18:58 -0700 (Thu, 04 Oct 2007) | 9 lines
Merged revisions 402-404 via svnmerge from
svn+ssh://torsion.org/home/luminotes/repos/luminotes/trunk
........
r403 | witten | 2007-10-04 01:14:45 -0700 (Thu, 04 Oct 2007) | 2 lines
Yay, no more stupid deprecation warnings from simplejson about the sre module.
........
................
r406 | witten | 2007-10-04 15:34:39 -0700 (Thu, 04 Oct 2007) | 4 lines
* Switched back to Python 2.4 because many Python modules in Debian are not packaged to work with Python 2.5
* Began removal of all references to Scheduler, @async, yield, and so on.
* Converted Database.py to support PostgreSQL and updated its unit tests accordingly.
................
r407 | witten | 2007-10-04 16:34:01 -0700 (Thu, 04 Oct 2007) | 2 lines
All unit tests for the new model classes now pass.
................
r409 | witten | 2007-10-05 00:53:56 -0700 (Fri, 05 Oct 2007) | 2 lines
Reordering some columns and adding some indices.
................
r410 | witten | 2007-10-05 16:08:37 -0700 (Fri, 05 Oct 2007) | 4 lines
Now adding trash notebooks to user_notebook table. Also switching db
conversion/verification tools back to require Python 2.5, since they still use
the old Scheduler, which requires 2.5 generator features.
................
r411 | witten | 2007-10-06 16:26:56 -0700 (Sat, 06 Oct 2007) | 2 lines
Lots more unit tests passing. Most of the recent work was on controller.Users and related stuff.
................
r412 | witten | 2007-10-07 01:52:12 -0700 (Sun, 07 Oct 2007) | 2 lines
controller.Users unit tests now finally pass!
................
r413 | witten | 2007-10-07 02:14:10 -0700 (Sun, 07 Oct 2007) | 3 lines
Got controller.Root unit tests passing.
Moved fake sql_* function shenanigans from Test_users.py to Test_controller.py, for use by other controller unit tests.
................
r414 | witten | 2007-10-08 23:11:11 -0700 (Mon, 08 Oct 2007) | 2 lines
All unit tests pass! Fuck yeah!
................
r415 | witten | 2007-10-08 23:13:07 -0700 (Mon, 08 Oct 2007) | 2 lines
Removing all references to Scheduler from luminotes.py
................
r416 | witten | 2007-10-08 23:54:51 -0700 (Mon, 08 Oct 2007) | 3 lines
Converted deleted_from to deleted_from_id in a few more places.
Fixed bug in Users.contents().
................
r417 | witten | 2007-10-09 00:11:59 -0700 (Tue, 09 Oct 2007) | 3 lines
Typo fix in Note sql method.
Adding autocommit flag to Database.next_id() method.
................
r418 | witten | 2007-10-09 00:13:19 -0700 (Tue, 09 Oct 2007) | 2 lines
Updating unit test for new auto commit flag.
................
r419 | witten | 2007-10-09 00:14:09 -0700 (Tue, 09 Oct 2007) | 2 lines
Removing debugging print.
................
r420 | witten | 2007-10-09 00:20:55 -0700 (Tue, 09 Oct 2007) | 2 lines
More sql fixes. I really need some funtional tests that hit the database and exercise the SQL.
................
r421 | witten | 2007-10-09 00:51:34 -0700 (Tue, 09 Oct 2007) | 3 lines
Fixed controller.Database handling of tuple as an Object_type.
Made SQL for user storage calculation better at handling null values and also more succinct.
................
r422 | witten | 2007-10-09 13:32:16 -0700 (Tue, 09 Oct 2007) | 2 lines
Converting Wiki.js to trash_id notebook member instead of trash object.
................
r423 | witten | 2007-10-09 13:42:10 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer displaying "download as html" on the front page, as people see "download" and think they're downloading the software.
................
r424 | witten | 2007-10-09 14:24:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Notebooks.contents() now returns notebooks with correct read-write status.
................
r425 | witten | 2007-10-09 14:32:25 -0700 (Tue, 09 Oct 2007) | 2 lines
Fixed reporting of validation errors to the user. Now says "The blah is missing." instead of just "is missing"
................
r426 | witten | 2007-10-09 17:05:22 -0700 (Tue, 09 Oct 2007) | 2 lines
No longer redirecting to trash notebook upon login.
................
r427 | witten | 2007-10-09 17:20:33 -0700 (Tue, 09 Oct 2007) | 2 lines
Made controller.Database use a connection pool.
................
r429 | witten | 2007-10-09 20:13:30 -0700 (Tue, 09 Oct 2007) | 2 lines
Converted initdb.py and updatedb.py to Postgres from bsddb.
................
r430 | witten | 2007-10-09 20:37:14 -0700 (Tue, 09 Oct 2007) | 2 lines
Changing error message to remove underscores from variable names.
................
r431 | witten | 2007-10-10 13:23:30 -0700 (Wed, 10 Oct 2007) | 2 lines
Removing unused note_title parameter from Wiki.create_editor().
................
r432 | witten | 2007-10-10 13:25:16 -0700 (Wed, 10 Oct 2007) | 2 lines
Revision regular expression now supports timezone notation.
................
r433 | witten | 2007-10-10 14:43:47 -0700 (Wed, 10 Oct 2007) | 2 lines
Finished implementing ranked ordering for startup notes. (However, there's no way to change the rank from the client yet.)
................
r434 | witten | 2007-10-10 16:25:19 -0700 (Wed, 10 Oct 2007) | 4 lines
More strict access checking. Fixed oversight in Postgres DB conversion where,
in certain controller.Notebook methods, access was only checked at the
notebook level, not at the note level as well.
................
r435 | witten | 2007-10-10 17:45:18 -0700 (Wed, 10 Oct 2007) | 3 lines
Now loading revisions on demand from client when the "changes" button is clicked. Also caching
loading revisions so subsequent clicks don't have to reload.
................
r436 | witten | 2007-10-10 21:31:20 -0700 (Wed, 10 Oct 2007) | 2 lines
Tweaking some of the error handling in Expose and Root so that unhandled errors give a generic error message to the client.
................
r437 | witten | 2007-10-10 21:33:49 -0700 (Wed, 10 Oct 2007) | 2 lines
The release script no longer runs initdb.py, because the default database is no longer a single file included in the tarball.
................
r438 | witten | 2007-10-10 21:40:11 -0700 (Wed, 10 Oct 2007) | 2 lines
Updated install instructuctions to include use of initdb.py.
................
r439 | witten | 2007-10-10 21:56:42 -0700 (Wed, 10 Oct 2007) | 3 lines
Made initdb.py only nuke (drop tables/views) when given a command-line flag.
Also made install directions more correct.
................
r440 | witten | 2007-10-10 21:58:48 -0700 (Wed, 10 Oct 2007) | 2 lines
IE 6 doesn't like commas.
................
r441 | witten | 2007-10-10 22:08:50 -0700 (Wed, 10 Oct 2007) | 4 lines
load your notebook. without clicking on "changes", edit a note that has previous revisions. click on "changes". it'll only show
the most recent revision. fixed by not appending to changes as a result of a save unless the client-side revisions list cache has
something in it
................
r442 | witten | 2007-10-10 23:30:41 -0700 (Wed, 10 Oct 2007) | 2 lines
Forgot to actually save off the new revision as editor.revision.
................
r443 | witten | 2007-10-11 01:35:54 -0700 (Thu, 11 Oct 2007) | 13 lines
More intelligent datetime handling:
* convertdb.py assumes old bsddb database timestamps are Pacific, and then
converts them to UTC before inserting them into the new PostgreSQL
database.
* No longer using naked timezoneless datetime objects in model/controller
code, except in unit tests that need compatability with pysqlite. Now
using UTC everwhere.
* Asking PostgreSQL to give us all timestamps back in UTC.
* New dependency on python-tz (pytz) package, noted in INSTALL doc.
* Client now responsible for converting UTC timestamps to local time for
display.
................
r444 | witten | 2007-10-11 01:46:09 -0700 (Thu, 11 Oct 2007) | 2 lines
Tweak to prevent potential race in IE.
................
r445 | witten | 2007-10-11 01:49:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Got JavaScript "unit" tests passing again.
................
r446 | witten | 2007-10-11 01:53:58 -0700 (Thu, 11 Oct 2007) | 2 lines
Noting that js tests require the Luminotes server on localhost.
................
2007-10-11 09:03:43 +00:00
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.check_password( new_password )
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.check_password( new_password2 )
|
2007-12-06 01:32:20 +00:00
|
|
|
|
|
|
|
def test_send_invites( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert u"An invitation has been sent." in result[ u"message" ]
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == 1
|
|
|
|
invite = invites[ -1 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2007-12-06 01:32:20 +00:00
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == 1
|
|
|
|
|
|
|
|
( from_address, to_addresses, message ) = smtplib.SMTP.emails[ 0 ]
|
|
|
|
assert self.email_address in from_address
|
|
|
|
assert to_addresses == email_addresses_list
|
|
|
|
assert self.notebooks[ 0 ].name in message
|
2007-12-11 01:15:03 +00:00
|
|
|
matches = self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
assert invite_id
|
|
|
|
|
|
|
|
# assert that the invite has the read_write / owner flags set appropriately
|
2008-08-19 21:22:40 +00:00
|
|
|
invite = self.database.load( Invite, invite_id )
|
2007-12-11 01:15:03 +00:00
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2008-05-06 23:29:43 +00:00
|
|
|
def test_send_invites_with_unicode_notebook_name( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
self.notebooks[ 0 ].name = u"\xe4"
|
|
|
|
quoted_printable_notebook_name = u"=C3=A4"
|
|
|
|
self.database.save( self.notebooks[ 0 ] )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert u"An invitation has been sent." in result[ u"message" ]
|
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == 1
|
|
|
|
invite = invites[ -1 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == 1
|
|
|
|
|
2008-08-21 21:06:26 +00:00
|
|
|
from email.Message import Message
|
|
|
|
from email import Charset
|
2008-05-06 23:29:43 +00:00
|
|
|
( from_address, to_addresses, message ) = smtplib.SMTP.emails[ 0 ]
|
|
|
|
|
|
|
|
assert self.email_address in from_address
|
|
|
|
assert to_addresses == email_addresses_list
|
|
|
|
assert u'Content-Type: text/plain; charset="utf-8"' in message
|
|
|
|
assert u'Content-Transfer-Encoding: quoted-printable' in message
|
|
|
|
assert quoted_printable_notebook_name in message
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
assert invite_id
|
|
|
|
|
|
|
|
# assert that the invite has the read_write / owner flags set appropriately
|
2008-08-19 21:22:40 +00:00
|
|
|
invite = self.database.load( Invite, invite_id )
|
2008-05-06 23:29:43 +00:00
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2007-12-11 01:15:03 +00:00
|
|
|
def test_send_invites_collaborator( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"collaborator",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert u"An invitation has been sent." in result[ u"message" ]
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == 1
|
|
|
|
invite = invites[ -1 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is True
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2007-12-11 01:15:03 +00:00
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == 1
|
|
|
|
|
|
|
|
( from_address, to_addresses, message ) = smtplib.SMTP.emails[ 0 ]
|
|
|
|
assert self.email_address in from_address
|
|
|
|
assert to_addresses == email_addresses_list
|
|
|
|
assert self.notebooks[ 0 ].name in message
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
assert invite_id
|
|
|
|
|
|
|
|
# assert that the invite has the read_write / owner flags set appropriately
|
2008-08-19 21:22:40 +00:00
|
|
|
invite = self.database.load( Invite, invite_id )
|
2007-12-11 01:15:03 +00:00
|
|
|
assert invite
|
|
|
|
assert invite.read_write is True
|
|
|
|
assert invite.owner is False
|
|
|
|
|
|
|
|
def test_send_invites_owner( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"owner",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert u"An invitation has been sent." in result[ u"message" ]
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == 1
|
|
|
|
invite = invites[ -1 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is True
|
|
|
|
assert invite.owner is True
|
|
|
|
|
2007-12-11 01:15:03 +00:00
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == 1
|
|
|
|
|
|
|
|
( from_address, to_addresses, message ) = smtplib.SMTP.emails[ 0 ]
|
|
|
|
assert self.email_address in from_address
|
|
|
|
assert to_addresses == email_addresses_list
|
|
|
|
assert self.notebooks[ 0 ].name in message
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
assert invite_id
|
|
|
|
|
|
|
|
# assert that the invite has the read_write / owner flags set appropriately
|
2008-08-19 21:22:40 +00:00
|
|
|
invite = self.database.load( Invite, invite_id )
|
2007-12-11 01:15:03 +00:00
|
|
|
assert invite
|
|
|
|
assert invite.read_write is True
|
|
|
|
assert invite.owner is True
|
2007-12-06 01:32:20 +00:00
|
|
|
|
|
|
|
def test_send_invites_multiple( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com", u"bar@example.com", u"baz@example.com" ]
|
|
|
|
email_addresses = u"Bob <%s>,%s\n %s " % \
|
|
|
|
( email_addresses_list[ 0 ], email_addresses_list[ 1 ], email_addresses_list[ 2 ] )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
email_count = len( email_addresses_list )
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == email_count
|
|
|
|
for invite in invites:
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2007-12-06 01:32:20 +00:00
|
|
|
assert u"%s invitations have been sent." % email_count in result[ u"message" ]
|
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == email_count
|
|
|
|
|
|
|
|
for ( from_address, to_addresses, message ) in smtplib.SMTP.emails:
|
|
|
|
assert self.email_address in from_address
|
|
|
|
assert len( to_addresses ) == 1
|
|
|
|
assert to_addresses[ 0 ] in email_addresses_list
|
|
|
|
email_addresses_list.remove( to_addresses[ 0 ] )
|
|
|
|
assert self.notebooks[ 0 ].name in message
|
|
|
|
assert self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
|
|
|
|
def test_send_invites_duplicate( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com", u"bar@example.com", u"foo@example.com" ]
|
|
|
|
email_addresses = u" %s N.E. One <%s>,\n%s" % \
|
|
|
|
( email_addresses_list[ 0 ], email_addresses_list[ 1 ], email_addresses_list[ 2 ] )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
email_count = len( email_addresses_list ) - 1 # -1 because of the duplicate
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == email_count
|
|
|
|
for invite in invites:
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2007-12-06 01:32:20 +00:00
|
|
|
assert u"%s invitations have been sent." % email_count in result[ u"message" ]
|
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == email_count
|
|
|
|
|
|
|
|
for ( from_address, to_addresses, message ) in smtplib.SMTP.emails:
|
|
|
|
assert self.email_address in from_address
|
|
|
|
assert len( to_addresses ) == 1
|
|
|
|
assert to_addresses[ 0 ] in email_addresses_list
|
|
|
|
email_addresses_list.remove( to_addresses[ 0 ] )
|
|
|
|
assert self.notebooks[ 0 ].name in message
|
|
|
|
assert self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
|
2007-12-06 22:05:00 +00:00
|
|
|
def test_send_invites_similar( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
# first send an invite with read_write and owner set to False
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 22:05:00 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
2007-12-30 01:20:38 +00:00
|
|
|
|
2007-12-06 22:05:00 +00:00
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id1 = matches.group( 2 )
|
|
|
|
assert invite_id1
|
|
|
|
|
2007-12-30 01:20:38 +00:00
|
|
|
# login as another user and redeem the invite
|
|
|
|
self.login2()
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id1,
|
|
|
|
), session_id = self.session_id )
|
2007-12-18 00:05:13 +00:00
|
|
|
|
2007-12-06 22:05:00 +00:00
|
|
|
# then send a similar invite to the same email address with read_write and owner set to True
|
2007-12-30 01:20:38 +00:00
|
|
|
self.login()
|
2007-12-13 20:26:32 +00:00
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
2007-12-06 22:05:00 +00:00
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"owner",
|
2007-12-06 22:05:00 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
2008-08-19 21:22:40 +00:00
|
|
|
assert len( invites ) == 2
|
2007-12-13 20:26:32 +00:00
|
|
|
invite = invites[ 0 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is True
|
|
|
|
assert invite.owner is True
|
2008-08-19 21:22:40 +00:00
|
|
|
invite = invites[ 1 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is True
|
|
|
|
assert invite.owner is True
|
2007-12-13 20:26:32 +00:00
|
|
|
|
2007-12-06 22:05:00 +00:00
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id2 = matches.group( 2 )
|
|
|
|
assert invite_id2
|
|
|
|
|
|
|
|
# assert that both invites have the read_write / owner flags set to True now
|
2008-08-19 21:22:40 +00:00
|
|
|
invite1 = self.database.load( Invite, invite_id1 )
|
2007-12-06 22:05:00 +00:00
|
|
|
assert invite1
|
|
|
|
assert invite1.read_write is True
|
2007-12-29 20:00:42 +00:00
|
|
|
assert invite1.owner is True
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
invite2 = self.database.load( Invite, invite_id2 )
|
2007-12-29 20:00:42 +00:00
|
|
|
assert invite2
|
|
|
|
assert invite2.read_write is True
|
|
|
|
assert invite2.owner is True
|
|
|
|
|
|
|
|
# assert that the user_notebook table has also been updated accordingly
|
2007-12-30 01:20:38 +00:00
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
2007-12-29 20:00:42 +00:00
|
|
|
self.notebooks[ 0 ].object_id,
|
|
|
|
read_write = True,
|
|
|
|
owner = True,
|
|
|
|
) )
|
|
|
|
assert access is True
|
2007-12-30 01:20:38 +00:00
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
|
|
|
self.notebooks[ 0 ].trash_id,
|
|
|
|
read_write = True,
|
|
|
|
owner = True,
|
|
|
|
) )
|
|
|
|
assert access is True
|
2007-12-29 20:00:42 +00:00
|
|
|
|
2007-12-30 01:20:38 +00:00
|
|
|
def test_send_invites_similar_downgrade( self ):
|
2007-12-29 20:00:42 +00:00
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
# first send an invite with read_write and owner set to False
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-30 01:20:38 +00:00
|
|
|
access = u"collaborator",
|
2007-12-29 20:00:42 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id1 = matches.group( 2 )
|
|
|
|
assert invite_id1
|
|
|
|
|
|
|
|
# login as another user and redeem the invite
|
|
|
|
self.login2()
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id1,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
2007-12-30 01:20:38 +00:00
|
|
|
# then send a similar invite to the same email address with read_write and owner set to False
|
2007-12-29 20:00:42 +00:00
|
|
|
self.login()
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-30 01:20:38 +00:00
|
|
|
access = u"viewer",
|
2007-12-29 20:00:42 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
invites = result[ u"invites" ]
|
2008-08-19 21:22:40 +00:00
|
|
|
assert len( invites ) == 2
|
2007-12-29 20:00:42 +00:00
|
|
|
invite = invites[ 0 ]
|
|
|
|
assert invite
|
2007-12-30 01:20:38 +00:00
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
2008-08-19 21:22:40 +00:00
|
|
|
invite = invites[ 1 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
2007-12-29 20:00:42 +00:00
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id2 = matches.group( 2 )
|
|
|
|
assert invite_id2
|
|
|
|
|
2007-12-30 01:20:38 +00:00
|
|
|
# assert that both invites have the read_write / owner flags set to False now
|
2008-08-19 21:22:40 +00:00
|
|
|
invite1 = self.database.load( Invite, invite_id1 )
|
2007-12-29 20:00:42 +00:00
|
|
|
assert invite1
|
2007-12-30 01:20:38 +00:00
|
|
|
assert invite1.read_write is False
|
|
|
|
assert invite1.owner is False
|
2007-12-06 22:05:00 +00:00
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
invite2 = self.database.load( Invite, invite_id2 )
|
2007-12-06 22:05:00 +00:00
|
|
|
assert invite2
|
2007-12-30 01:20:38 +00:00
|
|
|
assert invite2.read_write is False
|
|
|
|
assert invite2.owner is False
|
2007-12-06 22:05:00 +00:00
|
|
|
|
2007-12-18 00:05:13 +00:00
|
|
|
# assert that the user_notebook table has also been updated accordingly
|
2007-12-30 01:20:38 +00:00
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
|
|
|
self.notebooks[ 0 ].object_id,
|
|
|
|
read_write = False,
|
|
|
|
owner = False,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
|
|
|
self.notebooks[ 0 ].trash_id,
|
|
|
|
read_write = False,
|
|
|
|
owner = False,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
|
2007-12-06 01:32:20 +00:00
|
|
|
def test_send_invites_with_generic_from_address( self ):
|
|
|
|
self.login()
|
|
|
|
|
2007-12-13 20:26:32 +00:00
|
|
|
# setting the user's email address to None means the invite will be sent
|
|
|
|
# with a "generic" From address (in this case, Luminotes support)
|
2007-12-06 01:32:20 +00:00
|
|
|
self.user._User__email_address = None
|
2007-12-13 20:26:32 +00:00
|
|
|
self.user.rate_plan = 1
|
2007-12-06 01:32:20 +00:00
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == 1
|
|
|
|
invite = invites[ 0 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2007-12-06 01:32:20 +00:00
|
|
|
assert u"An invitation has been sent." in result[ u"message" ]
|
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == 1
|
|
|
|
|
|
|
|
( from_address, to_addresses, message ) = smtplib.SMTP.emails[ 0 ]
|
|
|
|
assert self.settings[ u"global" ][ u"luminotes.support_email" ] in from_address
|
|
|
|
assert to_addresses == email_addresses_list
|
|
|
|
assert self.notebooks[ 0 ].name in message
|
|
|
|
assert self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
|
|
|
|
def test_send_invites_without_login( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_send_invites_too_short( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
|
|
|
|
def test_send_invites_too_long( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"x" * 5001 ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
|
|
|
|
def test_send_invites_no_addresses( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"this is not an @email address!" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
|
2007-12-11 06:28:56 +00:00
|
|
|
def test_send_invites_without_username( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user._User__username = None
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
2007-12-06 01:32:20 +00:00
|
|
|
def test_send_invites_without_any_access( self ):
|
2008-08-19 21:22:40 +00:00
|
|
|
self.login2()
|
2007-12-06 01:32:20 +00:00
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
self.user2.rate_plan = 1
|
2007-12-06 01:32:20 +00:00
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_send_invites_without_read_write_access( self ):
|
|
|
|
self.login()
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
self.database.execute( self.user.sql_update_access( self.notebooks[ 0 ].object_id, read_write = False, owner = True ) )
|
2007-12-06 01:32:20 +00:00
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_send_invites_without_owner_access( self ):
|
|
|
|
self.login()
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
self.database.execute( self.user.sql_update_access( self.notebooks[ 0 ].object_id, read_write = True, owner = False ) )
|
2007-12-06 01:32:20 +00:00
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
2007-12-11 02:58:31 +00:00
|
|
|
def test_send_invites_viewer_with_lowest_rate_plan( self ):
|
2007-12-06 01:32:20 +00:00
|
|
|
self.login()
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
2007-12-11 02:58:31 +00:00
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
2007-12-13 20:26:32 +00:00
|
|
|
invites = result[ u"invites" ]
|
|
|
|
assert len( invites ) == 1
|
|
|
|
invite = invites[ 0 ]
|
|
|
|
assert invite
|
|
|
|
assert invite.read_write is False
|
|
|
|
assert invite.owner is False
|
|
|
|
|
2007-12-11 02:58:31 +00:00
|
|
|
assert u"An invitation has been sent." in result[ u"message" ]
|
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert len( smtplib.SMTP.emails ) == 1
|
|
|
|
|
|
|
|
( from_address, to_addresses, message ) = smtplib.SMTP.emails[ 0 ]
|
|
|
|
assert self.email_address in from_address
|
|
|
|
assert to_addresses == email_addresses_list
|
|
|
|
assert self.notebooks[ 0 ].name in message
|
|
|
|
assert self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
|
|
|
|
def test_send_invites_collaborator_with_lowest_rate_plan( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"collaborator",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_send_invites_owner_with_lowest_rate_plan( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"owner",
|
|
|
|
invite_button = u"send invites",
|
2007-12-06 01:32:20 +00:00
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_send_invites_with_unknown_notebook( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
unknown_notebook_id = u"neverheardofit"
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = unknown_notebook_id,
|
|
|
|
email_addresses = email_addresses,
|
2007-12-11 01:15:03 +00:00
|
|
|
access = u"viewer",
|
2007-12-06 01:32:20 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
session_id = result[ u"session_id" ]
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
2007-12-14 01:53:12 +00:00
|
|
|
def test_revoke_invite( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert len( result[ u"invites" ] ) == 1
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/revoke_invite", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"message" ]
|
|
|
|
assert len( result[ u"invites" ] ) == 0
|
|
|
|
|
|
|
|
def test_revoke_invite_multiple( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com", u"bar@example.com", u"foo@example.com" ]
|
|
|
|
email_addresses = u" ".join( email_addresses_list )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert len( result[ u"invites" ] ) == 2
|
|
|
|
( from_address, to_addresses, message ) = smtplib.SMTP.emails[ 0 ]
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/revoke_invite", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"message" ]
|
|
|
|
assert len( result[ u"invites" ] ) == 1
|
|
|
|
assert result[ u"invites" ][ 0 ].email_address == email_addresses_list[ 1 ]
|
|
|
|
|
2007-12-30 01:20:38 +00:00
|
|
|
def test_revoke_invite_redeemed( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert len( result[ u"invites" ] ) == 1
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
self.login2()
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-30 01:20:38 +00:00
|
|
|
|
|
|
|
self.login()
|
|
|
|
result = self.http_post( "/users/revoke_invite", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"message" ]
|
|
|
|
assert len( result[ u"invites" ] ) == 0
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert not cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert not cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-30 01:20:38 +00:00
|
|
|
|
|
|
|
def test_revoke_invite_redeemed_self( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
2008-01-06 21:59:22 +00:00
|
|
|
access = u"owner",
|
2007-12-30 01:20:38 +00:00
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert len( result[ u"invites" ] ) == 1
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
self.login2()
|
2007-12-30 01:20:38 +00:00
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
2008-10-24 18:51:19 +00:00
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-30 01:20:38 +00:00
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
# as user2, revoke that user's own invite
|
2007-12-30 01:20:38 +00:00
|
|
|
result = self.http_post( "/users/revoke_invite", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"message" ]
|
|
|
|
assert len( result[ u"invites" ] ) == 0
|
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
# the user should no longer have any access
|
2008-10-24 18:51:19 +00:00
|
|
|
assert not cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert not cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-30 01:20:38 +00:00
|
|
|
|
2007-12-14 01:53:12 +00:00
|
|
|
def test_revoke_invite_without_login( self ):
|
|
|
|
# login to send the invites, but don't send the logged-in session id for revoke_invite() below
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
2008-08-19 21:22:40 +00:00
|
|
|
|
2007-12-14 01:53:12 +00:00
|
|
|
assert len( result[ u"invites" ] ) == 1
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/revoke_invite", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
invite_id = invite_id,
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_revoke_invite_unknown( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
invite_id = u"unknowninviteid"
|
|
|
|
|
|
|
|
result = self.http_post( "/users/revoke_invite", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_revoke_invite_for_incorrect_notebook( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
result = self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert len( result[ u"invites" ] ) == 1
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/revoke_invite", dict(
|
|
|
|
notebook_id = self.notebooks[ 1 ].object_id,
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert "access" in result[ u"error" ]
|
|
|
|
|
2007-12-28 06:36:57 +00:00
|
|
|
def test_redeem_invite( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
) )
|
|
|
|
|
|
|
|
# assert that a redeem invite page is returned with sign up / login links
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert result[ u"notebook" ].name == self.anon_notebook.name
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"total_notes_count" ] == 1
|
|
|
|
assert result[ u"note_read_write" ] == False
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].object_id == "redeem_invite"
|
|
|
|
assert u"sign up" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"login" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"invites" ] ) == 0
|
|
|
|
|
|
|
|
def test_redeem_invite_unknown( self ):
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = "unknowninviteid",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert u"unknown" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_redeem_invite_after_login( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# assert that access has been granted
|
2008-10-24 18:51:19 +00:00
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-28 06:36:57 +00:00
|
|
|
|
|
|
|
# assert that the user is redirected to the notebook that the invite is for
|
|
|
|
assert result[ u"redirect"].startswith( u"/notebooks/" )
|
|
|
|
notebook_id = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
assert notebook_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_redeem_invite_after_login_already_redeemed( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# assert that access is still granted
|
2008-10-24 18:51:19 +00:00
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].object_id )
|
|
|
|
assert cherrypy.root.users.load_notebook( self.user2.object_id, self.notebooks[ 0 ].trash_id )
|
2007-12-28 06:36:57 +00:00
|
|
|
|
|
|
|
# assert that the user is redirected to the notebook that the invite is for
|
|
|
|
assert result[ u"redirect"].startswith( u"/notebooks/" )
|
|
|
|
notebook_id = result[ u"redirect" ].split( u"/notebooks/" )[ -1 ]
|
|
|
|
assert notebook_id == self.notebooks[ 0 ].object_id
|
|
|
|
|
|
|
|
def test_redeem_invite_after_login_already_redeemed_by_different_user( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
self.login2()
|
|
|
|
|
|
|
|
self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"already" in result[ u"error" ]
|
|
|
|
|
|
|
|
def test_redeem_invite_already_redeemed( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
2008-08-19 21:22:40 +00:00
|
|
|
|
|
|
|
self.login2()
|
2007-12-28 06:36:57 +00:00
|
|
|
|
|
|
|
self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/redeem_invite", dict(
|
|
|
|
invite_id = invite_id,
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"error" ]
|
|
|
|
assert u"already" in result[ u"error" ]
|
|
|
|
|
2007-12-18 00:05:13 +00:00
|
|
|
def test_convert_invite_to_access( self ):
|
2008-03-15 03:04:59 +00:00
|
|
|
# start the invitee out with access to one notebook
|
|
|
|
self.database.execute( self.user2.sql_save_notebook( self.notebooks[ 1 ].object_id, read_write = True, owner = False, rank = 7 ), commit = False )
|
2008-08-19 21:22:40 +00:00
|
|
|
self.database.commit()
|
2008-06-08 00:06:43 +00:00
|
|
|
|
2007-12-18 00:05:13 +00:00
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
# convert the invite to access for a different user
|
|
|
|
invite = self.database.load( Invite, invite_id )
|
|
|
|
cherrypy.root.users.convert_invite_to_access( invite, self.user2.object_id )
|
|
|
|
|
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
|
|
|
invite.notebook_id,
|
|
|
|
invite.read_write,
|
|
|
|
invite.owner,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
|
|
|
|
notebook = self.database.load( Notebook, invite.notebook_id )
|
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
|
|
|
notebook.trash_id,
|
|
|
|
invite.read_write,
|
|
|
|
invite.owner,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
|
2008-03-15 03:04:59 +00:00
|
|
|
notebooks = self.database.select_many( Notebook, self.user2.sql_load_notebooks() )
|
|
|
|
new_notebook = [ notebook for notebook in notebooks if notebook.object_id == invite.notebook_id ][ 0 ]
|
|
|
|
assert new_notebook.rank == 8 # one higher than the other notebook this user has access to
|
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
assert invite.redeemed_user_id == self.user2.object_id
|
|
|
|
|
|
|
|
def test_convert_invite_to_access_same_user( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
# here, the same user that sent the invite is trying to convert it to access
|
2007-12-18 00:05:13 +00:00
|
|
|
invite = self.database.load( Invite, invite_id )
|
|
|
|
cherrypy.root.users.convert_invite_to_access( invite, self.user.object_id )
|
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
# assert that the user retains the access they already had
|
2007-12-18 00:05:13 +00:00
|
|
|
access = self.database.select_one( bool, self.user.sql_has_access(
|
|
|
|
invite.notebook_id,
|
|
|
|
invite.read_write,
|
|
|
|
invite.owner,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
|
|
|
|
notebook = self.database.load( Notebook, invite.notebook_id )
|
|
|
|
access = self.database.select_one( bool, self.user.sql_has_access(
|
|
|
|
notebook.trash_id,
|
|
|
|
invite.read_write,
|
|
|
|
invite.owner,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
# assert that the invite was not actually redeemed
|
|
|
|
assert invite.redeemed_user_id == None
|
2007-12-18 00:05:13 +00:00
|
|
|
|
|
|
|
def test_convert_invite_to_access_twice( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
invite = self.database.load( Invite, invite_id )
|
2008-01-06 21:59:22 +00:00
|
|
|
cherrypy.root.users.convert_invite_to_access( invite, self.user2.object_id )
|
|
|
|
cherrypy.root.users.convert_invite_to_access( invite, self.user2.object_id )
|
2007-12-18 00:05:13 +00:00
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
2007-12-18 00:05:13 +00:00
|
|
|
invite.notebook_id,
|
|
|
|
invite.read_write,
|
|
|
|
invite.owner,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
|
|
|
|
notebook = self.database.load( Notebook, invite.notebook_id )
|
2008-01-06 21:59:22 +00:00
|
|
|
access = self.database.select_one( bool, self.user2.sql_has_access(
|
2007-12-18 00:05:13 +00:00
|
|
|
notebook.trash_id,
|
|
|
|
invite.read_write,
|
|
|
|
invite.owner,
|
|
|
|
) )
|
|
|
|
assert access is True
|
|
|
|
|
2008-01-06 21:59:22 +00:00
|
|
|
assert invite.redeemed_user_id == self.user2.object_id
|
2007-12-18 00:05:13 +00:00
|
|
|
|
|
|
|
@raises( Invite_error )
|
|
|
|
def test_convert_invite_with_unknown_user( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
self.database.save( self.user )
|
|
|
|
|
|
|
|
email_addresses_list = [ u"foo@example.com" ]
|
|
|
|
email_addresses = email_addresses_list[ 0 ]
|
|
|
|
|
|
|
|
self.http_post( "/users/send_invites", dict(
|
|
|
|
notebook_id = self.notebooks[ 0 ].object_id,
|
|
|
|
email_addresses = email_addresses,
|
|
|
|
access = u"viewer",
|
|
|
|
invite_button = u"send invites",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
matches = self.INVITE_LINK_PATTERN.search( smtplib.SMTP.message )
|
|
|
|
invite_id = matches.group( 2 )
|
|
|
|
|
|
|
|
invite = self.database.load( Invite, invite_id )
|
|
|
|
cherrypy.root.users.convert_invite_to_access( invite, u"unknown_user_id" )
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
PAYMENT_DATA = {
|
|
|
|
u"last_name": u"User",
|
|
|
|
u"txn_id": u"txn",
|
|
|
|
u"receiver_email": u"unittest@luminotes.com",
|
|
|
|
u"payment_status": u"Completed",
|
|
|
|
u"payment_gross": u"9.00",
|
|
|
|
u"residence_country": u"US",
|
|
|
|
u"payer_status": u"verified",
|
|
|
|
u"txn_type": u"subscr_payment",
|
|
|
|
u"payment_date": u"15:38:18 Jan 10 2008 PST",
|
|
|
|
u"first_name": u"Test",
|
|
|
|
u"item_name": u"Luminotes extra super",
|
|
|
|
u"charset": u"windows-1252",
|
|
|
|
u"notify_version": u"2.4",
|
|
|
|
u"item_number": u"1",
|
|
|
|
u"receiver_id": u"rcv",
|
|
|
|
u"business": u"unittest@luminotes.com",
|
|
|
|
u"payer_id": u"pyr",
|
|
|
|
u"verify_sign": u"vfy",
|
|
|
|
u"subscr_id": u"sub",
|
|
|
|
u"payment_fee": u"0.56",
|
|
|
|
u"mc_fee": u"0.56",
|
|
|
|
u"mc_currency": u"USD",
|
|
|
|
u"payer_email": u"buyer@luminotes.com",
|
|
|
|
u"payment_type": u"instant",
|
|
|
|
u"mc_gross": u"9.00",
|
|
|
|
}
|
|
|
|
|
|
|
|
def test_paypal_notify_payment( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
# being notified of a mere payment should not change the user's rate plan
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-05-08 18:39:46 +00:00
|
|
|
def test_paypal_notify_payment_yearly( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"payment_gross" ] = u"90.00"
|
|
|
|
data[ u"mc_gross" ] = u"90.00"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
# being notified of a mere payment should not change the user's rate plan
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-12-30 19:46:41 +00:00
|
|
|
def test_paypal_notify_payment_with_trial( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount1" ] = u"0.00"
|
|
|
|
data[ u"period1" ] = u"30 D"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
# being notified of a mere payment should not change the user's rate plan
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_with_trial_invalid_period( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount1" ] = u"0.00"
|
|
|
|
data[ u"period1" ] = u"31 D"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_with_trial_invalid_amount( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount1" ] = u"2.50"
|
|
|
|
data[ u"period1" ] = u"30 D"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_payment_invalid( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
Stub_urllib2.result = u"INVALID"
|
|
|
|
try:
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
finally:
|
|
|
|
Stub_urllib2.result = u"VERIFIED"
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_not_complete( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"payment_status" ] = u"NotEvenRemotelyCompleted"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_incorrect_receiver_email( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"receiver_email" ] = u"someoneelse@luminotes.com"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_incorrect_currency( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_currency" ] = u"EUR"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_invalid_item_number( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_number" ] = u"2"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
2008-05-08 18:39:46 +00:00
|
|
|
def test_paypal_notify_payment_missing_item_number( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
|
2008-09-02 02:18:05 +00:00
|
|
|
def test_paypal_notify_payment_blank_item_number( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_number" ] = u""
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_payment_incorrect_gross( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_gross" ] = u"8.75"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_incorrect_amount( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount3" ] = u"1.99"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_incorrect_item_name( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_name" ] = u"super professional"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_invalid_period1( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period1" ] = u"5 Y"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_invalid_period1( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period2" ] = u"7 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_invalid_period3( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period3" ] = u"2 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_missing_custom( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_invalid_custom( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = u"(&^(*&"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_payment_unknown_custom( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"custom" ] = u"1337"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
# being notified of a mere failure should not change the user's rate plan
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_invalid( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
Stub_urllib2.result = u"INVALID"
|
|
|
|
try:
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
finally:
|
|
|
|
Stub_urllib2.result = u"VERIFIED"
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_incorrect_receiver_email( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"receiver_email" ] = u"someoneelse@luminotes.com"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_incorrect_currency( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_currency" ] = u"EUR"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_invalid_item_number( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_number" ] = u"2"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_incorrect_gross( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_gross" ] = u"8.75"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_incorrect_amount( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount3" ] = u"1.99"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_incorrect_item_name( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_name" ] = u"super professional"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_invalid_period1( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period1" ] = u"5 Y"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_invalid_period1( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period2" ] = u"7 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_invalid_period3( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period3" ] = u"2 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_missing_custom( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_invalid_custom( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = u"(&^(*&"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
def test_paypal_notify_failed_unknown_custom( self ):
|
|
|
|
data = dict( self.PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_failed"
|
|
|
|
data[ u"custom" ] = u"1337"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
|
|
|
|
SUBSCRIPTION_DATA = {
|
|
|
|
u"last_name": u"User",
|
|
|
|
u"receiver_email": u"unittest@luminotes.com",
|
|
|
|
u"residence_country": u"US",
|
|
|
|
u"payer_status": u"verified",
|
|
|
|
u"txn_type": u"subscr_signup",
|
|
|
|
u"first_name": u"Test",
|
|
|
|
u"item_name": u"Luminotes extra super",
|
|
|
|
u"charset": u"windows-1252",
|
|
|
|
u"notify_version": u"2.4",
|
|
|
|
u"recurring": u"1",
|
|
|
|
u"item_number": u"1",
|
|
|
|
u"payer_id": u"pyr",
|
|
|
|
u"period3": u"1 M",
|
|
|
|
u"verify_sign": u"vfy",
|
|
|
|
u"subscr_id": u"sub",
|
|
|
|
u"amount3": u"9.00",
|
|
|
|
u"mc_amount3": u"9.00",
|
|
|
|
u"mc_currency": u"USD",
|
|
|
|
u"subscr_date": u"15:38:16 Jan 10 2008 PST",
|
|
|
|
u"payer_email": u"buyer@luminotes.com",
|
|
|
|
u"reattempt": u"1",
|
|
|
|
}
|
|
|
|
|
|
|
|
def test_paypal_notify_signup( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
def __load_admin_groups( self ):
|
|
|
|
groups = self.database.select_many( Group, self.user.sql_load_groups() )
|
|
|
|
|
|
|
|
return [ group for group in groups if group.admin ]
|
|
|
|
|
2008-06-09 21:29:31 +00:00
|
|
|
def __assert_has_admin_group( self, exactly_one = False ):
|
2008-08-19 21:22:40 +00:00
|
|
|
groups = self.__load_admin_groups()
|
|
|
|
|
|
|
|
assert len( groups ) > 0
|
2008-06-09 21:29:31 +00:00
|
|
|
if exactly_one is True:
|
2008-08-19 21:22:40 +00:00
|
|
|
assert len( groups ) == 1
|
2008-06-08 01:18:49 +00:00
|
|
|
|
2008-08-19 21:22:40 +00:00
|
|
|
assert groups[ 0 ]
|
|
|
|
assert groups[ 0 ].name == u"my group"
|
|
|
|
assert groups[ 0 ].admin is True
|
2008-06-08 01:18:49 +00:00
|
|
|
|
|
|
|
def __assert_no_admin_group( self ):
|
2008-08-19 21:22:40 +00:00
|
|
|
groups = self.__load_admin_groups()
|
|
|
|
|
|
|
|
assert len( groups ) == 0
|
2008-06-08 01:18:49 +00:00
|
|
|
|
2008-05-08 18:39:46 +00:00
|
|
|
def test_paypal_notify_signup_yearly( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"amount3" ] = u"90.00"
|
|
|
|
data[ u"mc_amount3" ] = u"90.00"
|
2008-06-19 00:13:13 +00:00
|
|
|
data[ u"period3" ] = u"1 Y"
|
2008-05-08 18:39:46 +00:00
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-06-09 21:29:31 +00:00
|
|
|
def test_paypal_notify_signup_with_existing_admin_group( self ):
|
|
|
|
self.user2.rate_plan = 0
|
|
|
|
self.database.save( self.user2, commit = False )
|
|
|
|
|
|
|
|
self.__create_admin_group( add_non_admin_user = True )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
|
|
|
# assert that the rate plan of the other user in the group changed as well
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.rate_plan == 1
|
|
|
|
|
|
|
|
# assert that a second admin group wasn't created
|
|
|
|
self.__assert_has_admin_group( exactly_one = True )
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_invalid( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
Stub_urllib2.result = u"INVALID"
|
|
|
|
try:
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
finally:
|
|
|
|
Stub_urllib2.result = u"VERIFIED"
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_incorrect_receiver_email( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"receiver_email" ] = u"someoneelse@luminotes.com"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_incorrect_currency( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_currency" ] = u"EUR"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_invalid_item_number( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_number" ] = u"2"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_incorrect_gross( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_gross" ] = u"8.75"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_incorrect_amount( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount3" ] = u"1.99"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_incorrect_item_name( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_name" ] = u"super professional"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_invalid_period1( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period1" ] = u"5 Y"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_invalid_period1( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period2" ] = u"7 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_invalid_period3( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period3" ] = u"2 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-05-08 18:39:46 +00:00
|
|
|
def test_paypal_notify_signup_yearly_period3_with_monthly_amount( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
2008-06-19 00:13:13 +00:00
|
|
|
data[ u"period3" ] = u"1 Y"
|
2008-05-08 18:39:46 +00:00
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-05-08 18:39:46 +00:00
|
|
|
def test_paypal_notify_signup_yearly_amount_with_monthly_period3( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount3" ] = u"19.90"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_missing_custom( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_invalid_custom( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = u"(&^(*&"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_unknown_custom( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"custom" ] = u"1337"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_missing_recurring( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
del( data[ u"recurring" ] )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_signup_invalid_recurring( self ):
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"recurring" ] = u"0"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-05-08 18:39:46 +00:00
|
|
|
def test_paypal_notify_modify_yearly( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"amount3" ] = u"90.00"
|
|
|
|
data[ u"mc_amount3" ] = u"90.00"
|
2008-06-19 00:13:13 +00:00
|
|
|
data[ u"period3" ] = u"1 Y"
|
2008-05-08 18:39:46 +00:00
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-06-09 21:29:31 +00:00
|
|
|
def test_paypal_notify_modify_with_existing_admin_group( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
self.user2.rate_plan = 0
|
|
|
|
self.database.save( self.user2, commit = False )
|
|
|
|
|
|
|
|
self.__create_admin_group( add_non_admin_user = True )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
|
|
|
# assert that the rate plan of the other user in the group changed as well
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.rate_plan == 1
|
|
|
|
|
|
|
|
# assert that a second admin group wasn't created
|
|
|
|
self.__assert_has_admin_group( exactly_one = True )
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_invalid( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
Stub_urllib2.result = u"INVALID"
|
|
|
|
try:
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
finally:
|
|
|
|
Stub_urllib2.result = u"VERIFIED"
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_incorrect_receiver_email( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"receiver_email" ] = u"someoneelse@luminotes.com"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_incorrect_currency( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_currency" ] = u"EUR"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_invalid_item_number( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_number" ] = u"2"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_incorrect_gross( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_gross" ] = u"8.75"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_incorrect_amount( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount3" ] = u"1.99"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_incorrect_item_name( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_name" ] = u"super professional"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_invalid_period1( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period1" ] = u"5 Y"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_invalid_period1( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period2" ] = u"7 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_invalid_period3( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period3" ] = u"2 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_missing_custom( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_invalid_custom( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = u"(&^(*&"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_unknown_custom( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"custom" ] = u"1337"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_missing_recurring( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
del( data[ u"recurring" ] )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_modify_invalid_recurring( self ):
|
|
|
|
self.user.rate_plan = 2
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_modify"
|
|
|
|
data[ u"recurring" ] = u"0"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 2
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
2008-05-08 18:39:46 +00:00
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-06-09 21:29:31 +00:00
|
|
|
def __create_admin_group( self, add_non_admin_user = False ):
|
2008-06-08 01:18:49 +00:00
|
|
|
group_id = self.database.next_id( Group, commit = False )
|
|
|
|
group = Group.create( group_id, name = u"my group", admin = True )
|
|
|
|
self.database.save( group, commit = False )
|
2008-08-19 21:22:40 +00:00
|
|
|
self.database.execute( self.user.sql_save_group( group_id, admin = True ) )
|
2008-06-09 21:29:31 +00:00
|
|
|
|
|
|
|
if add_non_admin_user is True:
|
2008-08-19 21:22:40 +00:00
|
|
|
self.database.execute( self.user2.sql_save_group( group_id, admin = False ) )
|
2008-06-09 21:29:31 +00:00
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.database.commit()
|
|
|
|
|
2008-05-08 18:39:46 +00:00
|
|
|
def test_paypal_notify_cancel_yearly( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-05-08 18:39:46 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"amount3" ] = u"90.00"
|
|
|
|
data[ u"mc_amount3" ] = u"90.00"
|
2008-06-19 00:13:13 +00:00
|
|
|
data[ u"period3" ] = u"1 Y"
|
2008-05-08 18:39:46 +00:00
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
2008-01-15 00:36:19 +00:00
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-06-09 21:29:31 +00:00
|
|
|
def test_paypal_notify_cancel_with_other_user_in_group( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
self.__create_admin_group( add_non_admin_user = True )
|
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 0
|
|
|
|
|
|
|
|
# assert that the rate plan of the other user in the group changed as well
|
|
|
|
user2 = self.database.load( User, self.user2.object_id )
|
|
|
|
assert user2.rate_plan == 0
|
|
|
|
|
|
|
|
self.__assert_no_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_invalid( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
Stub_urllib2.result = u"INVALID"
|
|
|
|
try:
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
finally:
|
|
|
|
Stub_urllib2.result = u"VERIFIED"
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_incorrect_receiver_email( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"receiver_email" ] = u"someoneelse@luminotes.com"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_incorrect_currency( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_currency" ] = u"EUR"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_invalid_item_number( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_number" ] = u"2"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_incorrect_gross( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_gross" ] = u"8.75"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_incorrect_amount( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"mc_amount3" ] = u"1.99"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_incorrect_item_name( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"item_name" ] = u"super professional"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_invalid_period1( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period1" ] = u"5 Y"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_invalid_period1( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period2" ] = u"7 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_invalid_period3( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
data[ u"period3" ] = u"2 M"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_missing_custom( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_invalid_custom( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = u"(&^(*&"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_unknown_custom( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"custom" ] = u"1337"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_missing_recurring( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
del( data[ u"recurring" ] )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_paypal_notify_cancel_invalid_recurring( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__create_admin_group()
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
data = dict( self.SUBSCRIPTION_DATA )
|
|
|
|
data[ u"txn_type" ] = u"subscr_cancel"
|
|
|
|
data[ u"recurring" ] = u"0"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert result.get( u"error" )
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-06-08 01:18:49 +00:00
|
|
|
self.__assert_has_admin_group()
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
REFUND_DATA = {
|
|
|
|
u"last_name": u"User",
|
|
|
|
u"txn_id": u"txn",
|
|
|
|
u"receiver_email": u"unittest@luminotes.com",
|
|
|
|
u"payment_status": u"Refunded",
|
|
|
|
u"payment_gross": u"-5.00",
|
|
|
|
u"reason_code": u"refund",
|
|
|
|
u"residence_country": u"US",
|
|
|
|
u"payment_date": u"20:31:40 Jan 11 2008 PST",
|
|
|
|
u"first_name": u"Test",
|
|
|
|
u"charset": u"windows-1252",
|
|
|
|
u"parent_txn_id": u"parent_txn",
|
|
|
|
u"notify_version": u"2.4",
|
|
|
|
u"item_number": u"1",
|
|
|
|
u"receiver_id": u"rcv",
|
|
|
|
u"business": u"unittest@luminotes.com",
|
|
|
|
u"payer_id": u"pyr",
|
|
|
|
u"verify_sign": u"vfy",
|
|
|
|
u"subscr_id": u"sub",
|
|
|
|
u"payment_fee": u"-0.45",
|
|
|
|
u"mc_fee": u"-0.45",
|
|
|
|
u"mc_currency": u"USD",
|
|
|
|
u"payer_email": u"buyer@luminotes.com",
|
|
|
|
u"payment_type": u"instant",
|
|
|
|
u"mc_gross": u"-5.00",
|
|
|
|
}
|
|
|
|
|
|
|
|
def test_paypal_notify_refund( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
data = dict( self.REFUND_DATA )
|
|
|
|
data[ u"custom" ] = self.user.object_id
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
|
|
|
|
# being notified of a mere refund should not change the user's rate plan
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.rate_plan == 1
|
|
|
|
|
2008-09-11 07:36:12 +00:00
|
|
|
DOWNLOAD_PAYMENT_DATA = {
|
|
|
|
u"last_name": u"User",
|
|
|
|
u"txn_id": u"txn",
|
|
|
|
u"receiver_email": u"unittest@luminotes.com",
|
|
|
|
u"payment_status": u"Completed",
|
|
|
|
u"payment_gross": u"30.00",
|
|
|
|
u"residence_country": u"US",
|
|
|
|
u"payer_status": u"verified",
|
|
|
|
u"txn_type": u"web_accept",
|
|
|
|
u"payment_date": u"15:38:18 Jan 10 2008 PST",
|
|
|
|
u"first_name": u"Test",
|
|
|
|
u"item_name": u"local desktop extravaganza",
|
|
|
|
u"charset": u"windows-1252",
|
|
|
|
u"notify_version": u"2.4",
|
|
|
|
u"item_number": u"5000",
|
|
|
|
u"receiver_id": u"rcv",
|
|
|
|
u"business": u"unittest@luminotes.com",
|
|
|
|
u"payer_id": u"pyr",
|
|
|
|
u"verify_sign": u"vfy",
|
|
|
|
u"payment_fee": u"1.19",
|
|
|
|
u"mc_fee": u"1.19",
|
|
|
|
u"mc_currency": u"USD",
|
|
|
|
u"shipping": u"0.00",
|
|
|
|
u"payer_email": u"buyer@luminotes.com",
|
|
|
|
u"payment_type": u"instant",
|
|
|
|
u"mc_gross": u"30.00",
|
|
|
|
u"quantity": u"1",
|
|
|
|
}
|
|
|
|
|
|
|
|
def __assert_download_payment_success( self, result, expect_email = True ):
|
|
|
|
assert len( result ) == 1
|
|
|
|
assert result.get( u"session_id" )
|
|
|
|
assert Stub_urllib2.result == u"VERIFIED"
|
|
|
|
assert Stub_urllib2.headers.get( u"Content-type" ) == u"application/x-www-form-urlencoded"
|
|
|
|
assert Stub_urllib2.url.startswith( "https://" )
|
|
|
|
assert u"paypal.com" in Stub_urllib2.url
|
|
|
|
assert Stub_urllib2.encoded_params
|
|
|
|
|
|
|
|
# verify that the user has been granted download access
|
|
|
|
download_access = self.database.select_one( Download_access, "select * from download_access order by revision desc limit 1;" );
|
|
|
|
assert download_access
|
|
|
|
assert download_access.item_number == u"5000"
|
|
|
|
assert download_access.transaction_id == u"txn"
|
|
|
|
|
|
|
|
if not expect_email:
|
|
|
|
return
|
|
|
|
|
|
|
|
# verify that an email has been sent to the user
|
|
|
|
assert smtplib.SMTP.connected == False
|
|
|
|
assert "<%s>" % self.settings[ u"global" ][ u"luminotes.support_email" ] in smtplib.SMTP.from_address
|
|
|
|
assert smtplib.SMTP.to_addresses == [ u"buyer@luminotes.com" ]
|
|
|
|
assert u"Thank you" in smtplib.SMTP.message
|
|
|
|
assert u"download" in smtplib.SMTP.message
|
|
|
|
assert u"upgrade" in smtplib.SMTP.message
|
|
|
|
|
|
|
|
expected_download_link = u"%s/d/%s" % \
|
|
|
|
( self.settings[ u"global" ][ u"luminotes.https_url" ], download_access.object_id )
|
|
|
|
assert expected_download_link in smtplib.SMTP.message
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_success( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_multiple_quantity( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"mc_gross" ] = u"90.0"
|
|
|
|
data[ u"quantity" ] = u"3"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_success( result )
|
|
|
|
|
|
|
|
def __assert_download_payment_error( self, result ):
|
|
|
|
assert u"error" in result
|
|
|
|
download_access = self.database.select_one( Download_access, "select * from download_access order by revision desc limit 1;" );
|
|
|
|
assert not download_access
|
|
|
|
assert not smtplib.SMTP.message
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_missing_mc_gross( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
del( data[ u"mc_gross" ] )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_none_mc_gross( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"mc_gross" ] = None
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_missing_quantity( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
del( data[ u"quantity" ] )
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_none_quantity( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"quantity" ] = None
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_quantity_mc_gross_mismatch( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"quantity" ] = u"2"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_mc_gross_fee_mismatch( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"quantity" ] = u"2"
|
|
|
|
data[ u"mc_gross" ] = u"61.0"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_invalid_item_name( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"item_name" ] = u"something unexpected"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_partial_item_name( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"item_name" ] = u"ultra LOCAL DESKTOP extravaganza digital download!"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_success( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_invalid_txn_type( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"txn_type" ] = u"web_wtf"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_invalid_txn_id( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"txn_id" ] = u"not even remotely valid"
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_error( result )
|
|
|
|
|
|
|
|
def test_paypal_notify_download_payment_missing_payer_email( self ):
|
|
|
|
data = dict( self.DOWNLOAD_PAYMENT_DATA )
|
|
|
|
data[ u"payer_email" ] = u""
|
|
|
|
result = self.http_post( "/users/paypal_notify", data );
|
|
|
|
self.__assert_download_payment_success( result, expect_email = False )
|
|
|
|
|
2008-01-15 00:36:19 +00:00
|
|
|
def test_thanks( self ):
|
|
|
|
self.user.rate_plan = 1
|
|
|
|
user = self.database.save( self.user )
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks", dict(
|
|
|
|
item_number = u"1",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-08-19 21:22:40 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"extra super"
|
2008-02-23 22:17:02 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 31337 * 1000
|
2008-01-15 00:36:19 +00:00
|
|
|
|
2008-01-22 20:29:29 +00:00
|
|
|
assert result[ u"conversion" ] == u"subscribe_1"
|
2008-01-15 00:36:19 +00:00
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"thank you"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"Thank you" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"Luminotes Extra super" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"confirmation" not in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
|
|
|
def test_thanks_not_yet_upgraded( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks", dict(
|
|
|
|
item_number = u"1",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2008-01-22 20:29:29 +00:00
|
|
|
assert result.get( u"conversion" ) == None
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-08-19 21:22:40 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert u"processing" in result[ u"notes" ][ 0 ].title
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"being processed" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"retry_count=1" in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
|
|
|
def test_thanks_not_yet_upgraded_with_retry( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks", dict(
|
|
|
|
item_number = u"1",
|
|
|
|
retry_count = u"5",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2008-01-22 20:29:29 +00:00
|
|
|
assert result.get( u"conversion" ) == None
|
2008-08-19 21:22:40 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert u"processing" in result[ u"notes" ][ 0 ].title
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"being processed" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"retry_count=6" in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
|
|
|
def test_thanks_with_retry_timeout( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks", dict(
|
|
|
|
item_number = u"1",
|
|
|
|
retry_count = u"16",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2008-01-22 20:29:29 +00:00
|
|
|
assert result.get( u"conversion" ) == None
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-08-19 21:22:40 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"thank you"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"Thank you" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"confirmation" in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
|
|
|
def test_thanks_without_item_number( self ):
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks", dict(
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2008-01-22 20:29:29 +00:00
|
|
|
assert result.get( u"conversion" ) == None
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-08-19 21:22:40 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-08-19 21:22:40 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
2008-03-01 00:26:06 +00:00
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
2008-02-23 08:59:39 +00:00
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
2008-01-15 00:36:19 +00:00
|
|
|
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"thank you"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"Thank you" in result[ u"notes" ][ 0 ].contents
|
2009-01-02 00:54:55 +00:00
|
|
|
assert u"confirmation" not in result[ u"notes" ][ 0 ].contents
|
2008-01-15 00:36:19 +00:00
|
|
|
|
2008-09-11 07:36:12 +00:00
|
|
|
def test_thanks_download( self ):
|
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
download_access = Download_access.create( access_id, item_number, transaction_id )
|
|
|
|
self.database.save( download_access )
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
|
|
|
access_id = access_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-09-11 07:36:12 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-09-11 07:36:12 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert result[ u"conversion" ] == u"download_5000"
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"thank you"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"Thank you" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"Luminotes Desktop" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"Download" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert VERSION in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
expected_download_link = u"%s/files/download_product?access_id=%s" % \
|
|
|
|
( self.settings[ u"global" ][ u"luminotes.https_url" ], access_id )
|
2008-09-11 07:36:12 +00:00
|
|
|
assert expected_download_link in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
|
|
|
def test_thanks_download_without_login( self ):
|
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
download_access = Download_access.create( access_id, item_number, transaction_id )
|
|
|
|
self.database.save( download_access )
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
|
|
|
access_id = access_id,
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert result[ u"user" ].username == self.anonymous.username
|
|
|
|
assert len( result[ u"notebooks" ] ) == 1
|
|
|
|
|
|
|
|
assert result[ u"login_url" ]
|
|
|
|
assert result[ u"logout_url" ]
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert result[ u"conversion" ] == u"download_5000"
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"thank you"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"Thank you" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"Luminotes Desktop" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"Download" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert VERSION in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
expected_download_link = u"%s/files/download_product?access_id=%s" % \
|
|
|
|
( self.settings[ u"global" ][ u"luminotes.https_url" ], access_id )
|
2008-09-11 07:36:12 +00:00
|
|
|
assert expected_download_link in result[ u"notes" ][ 0 ].contents
|
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
def test_thanks_download_tx( self ):
|
2008-09-11 07:36:12 +00:00
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
download_access = Download_access.create( access_id, item_number, transaction_id )
|
|
|
|
self.database.save( download_access )
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
2008-09-11 23:57:51 +00:00
|
|
|
tx = transaction_id,
|
2008-09-11 07:36:12 +00:00
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
redirect = result.get( u"redirect" )
|
2008-09-11 23:57:51 +00:00
|
|
|
expected_redirect = "/users/thanks_download?access_id=%s" % access_id
|
2008-09-11 07:36:12 +00:00
|
|
|
assert redirect == expected_redirect
|
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
def test_thanks_download_invalid_tx( self ):
|
2008-09-11 07:36:12 +00:00
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"invalid txn id"
|
|
|
|
|
|
|
|
download_access = Download_access.create( access_id, item_number, transaction_id )
|
|
|
|
self.database.save( download_access )
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
2008-09-11 23:57:51 +00:00
|
|
|
tx = transaction_id,
|
2008-09-11 07:36:12 +00:00
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"error" in result
|
|
|
|
|
|
|
|
def test_thanks_download_not_yet_paid( self ):
|
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
|
|
|
access_id = access_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# an unknown transaction id might just mean we're still waiting for the transaction to come in,
|
|
|
|
# so expect a retry
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-09-11 07:36:12 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-09-11 07:36:12 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert not result.get( u"conversion" )
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert u"processing" in result[ u"notes" ][ 0 ].title
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"being processed" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"retry_count=1" in result[ u"notes" ][ 0 ].contents
|
2008-10-07 20:59:34 +00:00
|
|
|
assert u'<meta content="2; URL=/users/thanks_download?access_id=%s&retry_count=1" http-equiv="Refresh"></meta>' % access_id \
|
|
|
|
in result[ u"notes" ][ 0 ].contents
|
2008-09-11 07:36:12 +00:00
|
|
|
|
|
|
|
def test_thanks_download_not_yet_paid_with_retry( self ):
|
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
|
|
|
access_id = access_id,
|
|
|
|
retry_count = u"3",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# an unknown transaction id might just mean we're still waiting for the transaction to come in,
|
|
|
|
# so expect a retry
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-09-11 07:36:12 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-09-11 07:36:12 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert not result.get( u"conversion" )
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert u"processing" in result[ u"notes" ][ 0 ].title
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"being processed" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"retry_count=4" in result[ u"notes" ][ 0 ].contents
|
2008-10-07 20:59:34 +00:00
|
|
|
assert u'<meta content="2; URL=/users/thanks_download?access_id=%s&retry_count=4" http-equiv="Refresh"></meta>' % access_id \
|
|
|
|
in result[ u"notes" ][ 0 ].contents
|
2008-09-11 07:36:12 +00:00
|
|
|
|
|
|
|
def test_thanks_download_not_yet_paid_with_retry_timeout( self ):
|
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
|
|
|
access_id = access_id,
|
|
|
|
retry_count = u"16",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# an unknown transaction id might just mean we're still waiting for the transaction to come in,
|
|
|
|
# so expect a retry
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-09-11 07:36:12 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-09-11 07:36:12 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert not result.get( u"conversion" )
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"thank you"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"Thank you" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"confirmation" in result[ u"notes" ][ 0 ].contents
|
2008-10-07 20:59:34 +00:00
|
|
|
assert u"<meta " not in result[ u"notes" ][ 0 ].contents
|
2008-09-11 07:36:12 +00:00
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
def test_thanks_download_not_yet_paid_tx( self ):
|
2008-09-11 07:36:12 +00:00
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
2008-09-11 23:57:51 +00:00
|
|
|
tx = transaction_id,
|
2008-09-11 07:36:12 +00:00
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# an unknown transaction id might just mean we're still waiting for the transaction to come in,
|
|
|
|
# so expect a retry
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-09-11 07:36:12 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-09-11 07:36:12 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert not result.get( u"conversion" )
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert u"processing" in result[ u"notes" ][ 0 ].title
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"being processed" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"retry_count=1" in result[ u"notes" ][ 0 ].contents
|
2008-10-07 20:59:34 +00:00
|
|
|
assert u'<meta content="2; URL=/users/thanks_download?tx=%s&retry_count=1" http-equiv="Refresh"></meta>' % transaction_id \
|
|
|
|
in result[ u"notes" ][ 0 ].contents
|
2008-09-11 07:36:12 +00:00
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
def test_thanks_download_not_yet_paid_tx_with_retry( self ):
|
2008-09-11 07:36:12 +00:00
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
2008-09-11 23:57:51 +00:00
|
|
|
tx = transaction_id,
|
2008-09-11 07:36:12 +00:00
|
|
|
item_number = item_number,
|
|
|
|
retry_count = u"3",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# an unknown transaction id might just mean we're still waiting for the transaction to come in,
|
|
|
|
# so expect a retry
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-09-11 07:36:12 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-09-11 07:36:12 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert not result.get( u"conversion" )
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert u"processing" in result[ u"notes" ][ 0 ].title
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"being processed" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"retry_count=4" in result[ u"notes" ][ 0 ].contents
|
2008-10-07 20:59:34 +00:00
|
|
|
assert u'<meta content="2; URL=/users/thanks_download?tx=%s&retry_count=4" http-equiv="Refresh"></meta>' % transaction_id \
|
|
|
|
in result[ u"notes" ][ 0 ].contents
|
2008-09-11 07:36:12 +00:00
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
def test_thanks_download_not_yet_paid_tx_with_retry_timeout( self ):
|
2008-09-11 07:36:12 +00:00
|
|
|
access_id = u"wheeaccessid"
|
|
|
|
item_number = u"5000"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
2008-09-11 23:57:51 +00:00
|
|
|
tx = transaction_id,
|
2008-09-11 07:36:12 +00:00
|
|
|
retry_count = u"16",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
# an unknown transaction id might just mean we're still waiting for the transaction to come in,
|
|
|
|
# so expect a retry
|
|
|
|
assert result[ u"user" ].username == self.user.username
|
2009-01-29 23:30:10 +00:00
|
|
|
assert len( result[ u"notebooks" ] ) == 2
|
2008-09-11 07:36:12 +00:00
|
|
|
notebook = [ notebook for notebook in result[ u"notebooks" ] if notebook.object_id == self.notebooks[ 0 ].object_id ][ 0 ]
|
|
|
|
assert notebook.object_id == self.notebooks[ 0 ].object_id
|
|
|
|
assert notebook.name == self.notebooks[ 0 ].name
|
2008-10-24 18:51:19 +00:00
|
|
|
assert notebook.read_write == Notebook.READ_WRITE
|
2008-09-11 07:36:12 +00:00
|
|
|
assert notebook.owner == True
|
|
|
|
assert notebook.rank == 0
|
|
|
|
|
|
|
|
assert result[ u"login_url" ] == None
|
|
|
|
assert result[ u"logout_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ] + u"/users/logout"
|
|
|
|
|
|
|
|
rate_plan = result[ u"rate_plan" ]
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan[ u"name" ] == u"super"
|
|
|
|
assert rate_plan[ u"storage_quota_bytes" ] == 1337 * 10
|
|
|
|
|
|
|
|
assert not result.get( u"conversion" )
|
|
|
|
assert result[ u"notebook" ].object_id == self.anon_notebook.object_id
|
|
|
|
assert len( result[ u"startup_notes" ] ) == 1
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].object_id == self.startup_note.object_id
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].title == self.startup_note.title
|
|
|
|
assert result[ u"startup_notes" ][ 0 ].contents == self.startup_note.contents
|
|
|
|
assert result[ u"note_read_write" ] is False
|
|
|
|
|
|
|
|
assert result[ u"notes" ]
|
|
|
|
assert len( result[ u"notes" ] ) == 1
|
|
|
|
assert result[ u"notes" ][ 0 ].title == u"thank you"
|
|
|
|
assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
|
|
|
|
assert u"Thank you" in result[ u"notes" ][ 0 ].contents
|
|
|
|
assert u"confirmation" in result[ u"notes" ][ 0 ].contents
|
2008-10-07 20:59:34 +00:00
|
|
|
assert u"<meta " not in result[ u"notes" ][ 0 ].contents
|
2008-09-11 07:36:12 +00:00
|
|
|
|
2008-09-11 23:57:51 +00:00
|
|
|
def test_thanks_download_missing_tx_missing_access_id( self ):
|
2008-09-11 07:36:12 +00:00
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"error" in result
|
|
|
|
|
|
|
|
def test_thanks_download_invalid_access_id( self ):
|
|
|
|
access_id = u"invalid access id"
|
|
|
|
transaction_id = u"txn"
|
|
|
|
|
|
|
|
self.login()
|
|
|
|
|
|
|
|
result = self.http_post( "/users/thanks_download", dict(
|
|
|
|
access_id = access_id,
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert u"error" in result
|
|
|
|
|
2008-02-23 08:14:19 +00:00
|
|
|
def test_rate_plan( self ):
|
|
|
|
plan_index = 1
|
|
|
|
rate_plan = cherrypy.root.users.rate_plan( plan_index )
|
|
|
|
|
|
|
|
assert rate_plan
|
|
|
|
assert rate_plan == self.settings[ u"global" ][ u"luminotes.rate_plans" ][ plan_index ]
|
|
|
|
|
2008-05-08 03:05:35 +00:00
|
|
|
def test_update_settings( self ):
|
|
|
|
self.login()
|
|
|
|
previous_revision = self.user.revision
|
|
|
|
|
|
|
|
result = self.http_post( "/users/update_settings", dict(
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
settings_button = u"save settings",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"email_address" ] == self.new_email_address
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.email_address == self.new_email_address
|
|
|
|
assert user.revision > previous_revision
|
|
|
|
|
|
|
|
def test_update_settings_without_login( self ):
|
|
|
|
original_revision = self.user.revision
|
|
|
|
|
|
|
|
result = self.http_post( "/users/update_settings", dict(
|
|
|
|
email_address = self.new_email_address,
|
|
|
|
settings_button = u"save settings",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"access" in result[ u"error" ]
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.email_address == self.email_address
|
|
|
|
assert user.revision == original_revision
|
|
|
|
|
|
|
|
def test_update_settings_with_same_email_address( self ):
|
|
|
|
self.login()
|
|
|
|
original_revision = self.user.revision
|
|
|
|
|
|
|
|
result = self.http_post( "/users/update_settings", dict(
|
|
|
|
email_address = self.email_address,
|
|
|
|
settings_button = u"save settings",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"email_address" ] == self.email_address
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.email_address == self.email_address
|
|
|
|
assert user.revision == original_revision
|
|
|
|
|
|
|
|
def test_update_settings_with_invalid_email_address( self ):
|
|
|
|
original_revision = self.user.revision
|
|
|
|
|
|
|
|
result = self.http_post( "/users/update_settings", dict(
|
|
|
|
email_address = u"foo@bar@com",
|
|
|
|
settings_button = u"save settings",
|
|
|
|
) )
|
|
|
|
|
|
|
|
assert u"invalid" in result[ u"error" ]
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.email_address == self.email_address
|
|
|
|
assert user.revision == original_revision
|
|
|
|
|
|
|
|
def test_update_settings_with_blank_email_address( self ):
|
|
|
|
self.login()
|
|
|
|
previous_revision = self.user.revision
|
|
|
|
|
|
|
|
result = self.http_post( "/users/update_settings", dict(
|
|
|
|
email_address = u"",
|
|
|
|
settings_button = u"save settings",
|
|
|
|
), session_id = self.session_id )
|
|
|
|
|
|
|
|
assert result[ u"email_address" ] == None
|
|
|
|
|
|
|
|
user = self.database.load( User, self.user.object_id )
|
|
|
|
assert user.email_address == None
|
|
|
|
assert user.revision > previous_revision
|
|
|
|
|
2007-12-06 01:32:20 +00:00
|
|
|
def login( self ):
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = self.username,
|
|
|
|
password = self.password,
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
self.session_id = result[ u"session_id" ]
|
2007-12-27 22:16:47 +00:00
|
|
|
|
|
|
|
def login2( self ):
|
|
|
|
result = self.http_post( "/users/login", dict(
|
|
|
|
username = self.username2,
|
|
|
|
password = self.password2,
|
|
|
|
login_button = u"login",
|
|
|
|
) )
|
|
|
|
self.session_id = result[ u"session_id" ]
|