Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1725] Datastore must be the first IDatastore plugin loaded
This allows extensions to rely on it running before them.
- Loading branch information
1 parent
b4befdd
commit df8c1af
Showing
2 changed files
with
39 additions
and
0 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,27 @@ | ||
import nose | ||
|
||
import ckan.plugins as p | ||
import ckanext.datastore.plugin as datastore | ||
|
||
|
||
assert_raises = nose.tools.assert_raises | ||
|
||
|
||
class TestPlugin(object): | ||
@classmethod | ||
def setup(cls): | ||
if p.plugin_loaded('datastore'): | ||
p.unload('datastore') | ||
if p.plugin_loaded('sample_datastore_plugin'): | ||
p.unload('sample_datastore_plugin') | ||
|
||
def test_loading_datastore_first_works(self): | ||
p.load('datastore') | ||
p.load('sample_datastore_plugin') | ||
p.unload('sample_datastore_plugin') | ||
p.unload('datastore') | ||
|
||
def test_loading_datastore_last_doesnt_work(self): | ||
p.load('sample_datastore_plugin') | ||
assert_raises(datastore.DatastoreException, p.load, 'datastore') | ||
p.unload('sample_datastore_plugin') |