-
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.
- Loading branch information
Showing
5 changed files
with
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
env: | ||
- CKANVERSION=master | ||
- CKANVERSION=2.2 | ||
- CKANVERSION=2.3 | ||
install: | ||
- bash bin/travis-build.bash | ||
script: sh bin/travis-run.sh |
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,44 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "This is travis-build.bash..." | ||
|
||
echo "Installing the packages that CKAN requires..." | ||
sudo apt-get update -qq | ||
sudo apt-get install postgresql-$PGVERSION solr-jetty libcommons-fileupload-java:amd64=1.2.2-1 | ||
|
||
echo "Installing CKAN and its Python dependencies..." | ||
git clone https://github.com/ckan/ckan | ||
cd ckan | ||
if [ $CKANVERSION == '2.3' ] | ||
then | ||
git checkout release-v2.3 | ||
elif [ $CKANVERSION == '2.2' ] | ||
then | ||
git checkout release-v2.2.3 | ||
fi | ||
python setup.py develop | ||
cp ./ckan/public/base/css/main.css ./ckan/public/base/css/main.debug.css | ||
pip install -r requirements.txt --allow-all-external | ||
pip install -r dev-requirements.txt --allow-all-external | ||
cd - | ||
|
||
echo "Creating the PostgreSQL user and database..." | ||
sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';" | ||
sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;' | ||
sudo -u postgres psql -c 'CREATE DATABASE datastore_test WITH OWNER ckan_default;' | ||
|
||
#echo "Initialising the database..." | ||
#cd ckan | ||
#paster db init -c test-core.ini | ||
#cd - | ||
|
||
echo "Installing ckanext-pages and its requirements..." | ||
python setup.py develop | ||
pip install -r dev-requirements.txt | ||
|
||
echo "Moving test.ini into a subdir..." | ||
mkdir subdir | ||
mv test.ini subdir | ||
|
||
echo "travis-build.bash is done." |
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,6 @@ | ||
#!/bin/sh -e | ||
|
||
echo "NO_START=0\nJETTY_HOST=127.0.0.1\nJETTY_PORT=8983\nJAVA_HOME=$JAVA_HOME" | sudo tee /etc/default/jetty | ||
sudo cp ckan/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml | ||
sudo service jetty restart | ||
nosetests --ckan --nologcapture --with-pylons=subdir/test.ini --reset-db --with-coverage --cover-package=ckanext.pages --cover-inclusive --cover-erase --cover-tests |
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 @@ | ||
from ckan.plugins import toolkit | ||
from ckan.new_tests import factories, helpers | ||
|
||
|
||
class TestUpdate(helpers.FunctionalTestBase): | ||
def setup(self): | ||
super(TestUpdate, self).setup() | ||
self.user = factories.Sysadmin() | ||
self.app = self._get_test_app() | ||
|
||
def teardown(self): | ||
helpers.reset_db() | ||
|
||
def test_create_page(self): | ||
env = {'REMOTE_USER': self.user['name'].encode('ascii')} | ||
response = self.app.post( | ||
url=toolkit.url_for('pages_edit', page='/test_page'), | ||
params={ | ||
'title': 'Page Title', | ||
'name': 'page_name', | ||
}, | ||
extra_environ=env, | ||
) | ||
response = response.follow(extra_environ=env) | ||
assert '<h1 class="page-heading">Page Title</h1>' in response.body |