Merge lp://staging/~jkakar/todo/login-command into lp://staging/todo

Proposed by Jamu Kakar
Status: Needs review
Proposed branch: lp://staging/~jkakar/todo/login-command
Merge into: lp://staging/todo
Prerequisite: lp://staging/~jkakar/todo/project-skeleton
Diff against target: 644 lines (+571/-1)
11 files modified
todo/application.py (+41/-0)
todo/commands.py (+57/-0)
todo/entry_point.py (+3/-1)
todo/model.py (+57/-0)
todo/testing/__init__.py (+15/-0)
todo/testing/basic.py (+27/-0)
todo/testing/doubles.py (+87/-0)
todo/tests/__init__.py (+15/-0)
todo/tests/test_application.py (+62/-0)
todo/tests/test_commands.py (+126/-0)
todo/tests/test_model.py (+81/-0)
To merge this branch: bzr merge lp://staging/~jkakar/todo/login-command
Reviewer Review Type Date Requested Status
Todo Team Pending
Review via email: mp+47195@code.staging.launchpad.net

Description of the change

This branch introduces the following changes:

- A bunch of testing support has been added in a new todo.testing
  package. There's a TodoTestCase with support for using test
  resources and for testing Twisted-based code. There's a also a
  todo.doubles module with a FakeEndpoint that can be used to write
  tests for code that use txFluidDB. The MockEndpoint in txFluidDB
  itself isn't useful, unfortunately, because it only allows one
  response to be mocked at a time. At some point soon we'll need more
  than that.

- A new todo.application module contains helper functions to get the
  default path for configuration data and to create the default
  endpoint.

- A new todo.model module contains the beginnings of a model layer.
  So far it has a login function and an empty Person class (which I
  expect to eventually expose methods like 'create_task',
  'create_category', etc.)

- A new todo.commands module contains a new 'login' command. It uses
  the model layer to perform actual authentication and takes care of
  writing credentials to disk (which I guess is specific to the CLI
  interface).

Hopefully subsequent branches will be a bit easier to push forward,
now that testing support is in place. The 'login' command doesn't
create a namespace for tasks yet. I decided to defer that to a
subsequent branch, since this one is already getting a bit big.

To post a comment you must log in.
Revision history for this message
Jamu Kakar (jkakar) wrote :

Just had a thought, which I'll record here so I don't forget it:

It'd be nice to add a test to ensure that cached credentials are
completely rewritten when the 'login' command is run more than once.

Revision history for this message
Jamu Kakar (jkakar) wrote :

Actually, thinking about this more, the call to /user/<username>
doesn't actually do any validation of the password... does it? Maybe
this branch isn't ready for review. Would appreciate a scan and some
advice about what to do in the todo.model.login function.

19. By Jamu Kakar

- Fixed typo in test.

Revision history for this message
Jamu Kakar (jkakar) wrote :

After talking with Terry on IRC I realize the previous question
doesn't make sense. Things should be fine.

Revision history for this message
Terry Jones (terrycojones) wrote :

The above question was answered (yes) in IRC just now.

Revision history for this message
Jamu Kakar (jkakar) wrote :

Ah, just realized something... even though the credentials are being
checked, I haven't verified that the HTTP response when they're
invalid or for an unknown user are the same as what I'm using in the
test. That should be done before this branch is merged.

Unmerged revisions

19. By Jamu Kakar

- Fixed typo in test.

18. By Jamu Kakar

- Fixed type in program name.

17. By Jamu Kakar

- Added a todo.commands module with a 'login' command that
  authenticates a user against FluidDB and writes credentials to disk.

16. By Jamu Kakar

- Add a new todo.model module with a login function and the beginnings
  of a Person model class.

15. By Jamu Kakar

- A new todo.testing.doubles module contains a FakeEndpoint (and
  FakeRequest) that can be used to test code that uses txFluidDB.

14. By Jamu Kakar

- Updated TodoTestCase to work for Twisted-based code.

13. By Jamu Kakar

- Added a new todo.application module with functions to get the
  configuration path and create a default txfluiddb.client.Endpoint.

12. By Jamu Kakar

- Added todo.tests package.

11. By Jamu Kakar

- Add a new todo.testing package to contain support for the test
  suite. A TodoTestCase combines the testresources and testtools test
  case classes.

10. By Jamu Kakar

- Added 'commandant' to the requires list in setup.py.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: