forked from benoitc/couchapp
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[generator] Test cases for
init_basic
and save_id
ref: #230
- Loading branch information
Showing
2 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from couchapp.generator import init_basic, save_id | ||
|
||
from mock import patch | ||
|
||
|
||
@patch('couchapp.generator.save_id') | ||
@patch('couchapp.generator.setup_dirs') | ||
@patch('couchapp.generator.setup_dir') | ||
@patch('couchapp.generator.localdoc') | ||
def test_init_basic(localdoc, setup_dir, setup_dirs, save_id): | ||
init_basic('/mock/app') | ||
|
||
assert setup_dir.called | ||
assert setup_dirs.called | ||
assert save_id.called | ||
assert localdoc.document.called | ||
|
||
|
||
@patch('couchapp.generator.open') | ||
def test_save_id(open_): | ||
save_id('/mock/app', 'someid') | ||
|
||
open_.assert_called_with('/mock/app/_id', 'wb') |