Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lettuce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
lettuce
Commits
20e1e1a6
Commit
20e1e1a6
authored
May 28, 2013
by
Alexey Kotlyarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LETTUCE_USE_TEST_DATABASE setting for always running on a test database
parent
250945fb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
1 deletions
+30
-1
lettuce/django/management/commands/harvest.py
+2
-1
tests/integration/django/dill/leaves/features/steps.py
+4
-0
tests/integration/django/dill/leaves/features/testdb.feature
+6
-0
tests/integration/django/dill/testdbsettings.py
+3
-0
tests/integration/test_dill.py
+15
-0
No files found.
lettuce/django/management/commands/harvest.py
View file @
20e1e1a6
...
@@ -50,7 +50,8 @@ class Command(BaseCommand):
...
@@ -50,7 +50,8 @@ class Command(BaseCommand):
make_option
(
'-S'
,
'--no-server'
,
action
=
'store_true'
,
dest
=
'no_server'
,
default
=
False
,
make_option
(
'-S'
,
'--no-server'
,
action
=
'store_true'
,
dest
=
'no_server'
,
default
=
False
,
help
=
"will not run django's builtin HTTP server"
),
help
=
"will not run django's builtin HTTP server"
),
make_option
(
'-T'
,
'--test-server'
,
action
=
'store_true'
,
dest
=
'test_database'
,
default
=
False
,
make_option
(
'-T'
,
'--test-server'
,
action
=
'store_true'
,
dest
=
'test_database'
,
default
=
getattr
(
settings
,
"LETTUCE_USE_TEST_DATABASE"
,
False
),
help
=
"will run django's builtin HTTP server using the test databases"
),
help
=
"will run django's builtin HTTP server using the test databases"
),
make_option
(
'-P'
,
'--port'
,
type
=
'int'
,
dest
=
'port'
,
make_option
(
'-P'
,
'--port'
,
type
=
'int'
,
dest
=
'port'
,
...
...
tests/integration/django/dill/leaves/features/steps.py
View file @
20e1e1a6
...
@@ -44,3 +44,7 @@ def database_dump(step):
...
@@ -44,3 +44,7 @@ def database_dump(step):
@step
(
r'I have populated the database'
)
@step
(
r'I have populated the database'
)
def
database_populated
(
step
):
def
database_populated
(
step
):
pass
pass
@step
(
r'I count the harvesters'
)
def
count_harvesters
(
step
):
print
"Harvester count:
%
d"
%
Harvester
.
objects
.
count
()
tests/integration/django/dill/leaves/features/testdb.feature
0 → 100644
View file @
20e1e1a6
Feature
:
Test running with the test database
Scenario
:
Test running with the test database
Given I have a harvester in the database
:
|
make
|
|
Frank
|
Then
I count the harvesters
tests/integration/django/dill/testdbsettings.py
0 → 100644
View file @
20e1e1a6
from
settings
import
*
LETTUCE_USE_TEST_DATABASE
=
True
tests/integration/test_dill.py
View file @
20e1e1a6
...
@@ -76,3 +76,18 @@ def test_model_existence_check():
...
@@ -76,3 +76,18 @@ def test_model_existence_check():
assert
"Expected 2 geese, found 1"
in
out
assert
"Expected 2 geese, found 1"
in
out
FileSystem
.
popd
()
FileSystem
.
popd
()
def
test_use_test_database_setting
():
'Test database is recreated each time if LETTUCE_USE_TEST_DATABASE is set'
FileSystem
.
pushd
(
current_directory
,
"django"
,
"dill"
)
for
i
in
range
(
1
,
2
):
status
,
out
=
commands
.
getstatusoutput
(
"python manage.py harvest --settings=testdbsettings "
+
"leaves/features/testdb.feature"
)
assert_equals
(
status
,
0
,
out
)
assert
"Harvester count: 1"
in
out
,
out
FileSystem
.
popd
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment