Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
d4bfc397
Commit
d4bfc397
authored
6 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
check upload formats only on slave
parent
6960918b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/tests/test_env.py
+2
-2
2 additions, 2 deletions
ckanext/odsh/tests/test_env.py
ckanext/odsh/tests/test_routes.py
+60
-0
60 additions, 0 deletions
ckanext/odsh/tests/test_routes.py
with
62 additions
and
2 deletions
ckanext/odsh/tests/test_env.py
+
2
−
2
View file @
d4bfc397
...
...
@@ -91,7 +91,6 @@ class TestEnv:
def
test_config_set
(
self
):
checkConfigForDuplicates
()
checkConfig
(
'
ckanext.odsh.upload_formats
'
,
minLength
=
2
)
checkConfig
(
'
ckanext.dcat.rdf.profiles
'
,
'
odsheuro_dcat_ap odshdcatap_de
'
)
checkConfig
(
'
ckan.harvest.mq.type
'
,
'
redis
'
)
...
...
@@ -112,6 +111,7 @@ class TestEnv:
checkConfigDir
(
'
ckan.storage_path
'
)
if
isSlave
():
checkConfig
(
'
ckanext.odsh.upload_formats
'
,
minLength
=
2
)
checkConfig
(
'
ckanext.spatial.search_backend
'
,
'
solr-spatial-field
'
)
checkConfig
(
'
ckanext.spatial.common_map.type
'
,
'
wms
'
)
checkConfig
(
'
ckanext.spatial.common_map.wms.url
'
,
...
...
@@ -132,7 +132,7 @@ class TestEnv:
assert
p
in
value
,
'
missing plugin:
'
+
p
if
isMaster
():
for
p
in
[
'
odsh_icap
'
,
'
odsh_dcat_harvest
'
,
'
odsh
'
,
'
odsh_harvest
'
]:
for
p
in
[
'
odsh_icap
'
,
'
odsh_dcat_harvest
'
,
'
odsh_harvest
'
]:
assert
p
in
value
,
'
missing plugin:
'
+
p
# pdb.set_trace()
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/tests/test_routes.py
0 → 100644
+
60
−
0
View file @
d4bfc397
from
ckan.common
import
config
import
ckan.model
as
model
import
pdb
import
json
import
ckanext.odsh.profiles
as
profiles
import
urllib2
import
ckan.tests.helpers
as
helpers
from
ckan.common
import
config
import
ckan.config.middleware
from
routes
import
url_for
webtest_submit
=
helpers
.
webtest_submit
# run with nosetests --ckan --nologcapture --with-pylons=<config to test> ckanext/odsh/tests/test_routes.py
def
_get_test_app
():
app
=
ckan
.
config
.
middleware
.
make_app
(
config
[
'
global_conf
'
],
**
config
)
app
=
helpers
.
CKANTestApp
(
app
)
return
app
class
TestRoutes
:
def
test_upload_empty_form_fails
(
self
):
# arrange
self
.
_login
()
form
=
self
.
_get_package_new_form
()
# # act
response
=
self
.
_submit_form
(
form
)
# # assert
# response.mustcontain('Title: Missing value')
# response.mustcontain('Description: Missing value')
# response.mustcontain('temporal_start: empty')
def
_get_package_new_form
(
self
):
# self.env = {'REMOTE_USER': 'ckanuser'}
response
=
self
.
app
.
get
(
url
=
url_for
(
controller
=
'
package
'
,
action
=
'
new
'
)
# extra_environ=self.env,
)
return
response
.
forms
[
'
dataset-edit
'
]
def
_login
(
self
):
app
=
_get_test_app
()
response
=
app
.
get
(
'
/user/login
'
)
login_form
=
response
.
forms
[
0
]
login_form
[
'
login
'
]
=
'
ckanuser
'
login_form
[
'
password
'
]
=
'
pass
'
submit_response
=
login_form
.
submit
(
'
save
'
)
final_response
=
helpers
.
webtest_maybe_follow
(
submit_response
)
# the response is the user dashboard, right?
# final_response.mustcontain('<a href="/dashboard">Dashboard</a>',
# '<span class="username">sysadmin</span>')
self
.
app
=
app
def
_submit_form
(
self
,
form
):
return
webtest_submit
(
form
,
'
save
'
,
status
=
200
)
#, extra_environ=self.env)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment