/rnacentral-webcode

RNAcentral website source code

Primary LanguagePythonApache License 2.0Apache-2.0

RNAcentral Website

Build Status

About

RNAcentral is an open public resource that offers integrated access to a comprehensive and up-to-date set of ncRNA sequences. For more information, please visit http://rnacentral.org/about-us.

The development of RNAcentral is coordinated by the European Bioinformatics Institute and is funded by the BBSRC.

Installation

  1. Clone Git repository:
git clone --recursive https://github.com/RNAcentral/rnacentral-webcode.git
  1. Edit database connection parameters in rnacentral/local_settings.py

  2. Run the app using Docker:

export RNACENTRAL_HOME=/path/to/rnacentral/code
cd $RNACENTRAL_HOME
docker-compose up --build

Docker Cheat Sheet

# connect to a running container
docker ps
docker exec -it <container_id> bash

Testing

Selenium tests

  1. Install selenium and requests using virtualenv:
virtualenv /path/to/testing/virtualenv
source /path/to/testing/virtualenv/bin/activate
pip install requests selenium
  1. Install Gecko Driver and add it to the PATH:
export PATH=$PATH:/path/to/geckodriver
  1. Start the website locally using Docker (see above).

  2. Launch tests against the local RNAcentral website:

cd $RNACENTRAL_HOME
python rnacentral/portal/tests/selenium_tests.py

These tests run automatically using Travis.

API tests

  1. Login to the running Docker container (see above).

  2. Launch tests:

cd $RNACENTRAL_HOME
python rnacentral/apiv1/tests.py

Application-specific tests

Using Django test runner:

cd $RNACENTRAL_HOME
python manage.py test portal.tests.description_tests

Using py.test requires creating a file rnacentral/conftest.py:

import django
import pytest

django.setup()


@pytest.fixture(scope='session')
def django_db_setup():
    """Avoid creating/setting up the test database"""
    pass


@pytest.fixture
def db_access_without_rollback_and_truncate(request, django_db_setup,
                                            django_db_blocker):
    django_db_blocker.unblock()
    request.addfinalizer(django_db_blocker.restore)

The following file is also required:

$ cat pytest.ini
[pytest]
DJANGO_SETTINGS_MODULE = rnacentral.settings

Tests can then be run with:

cd $RNACENTRAL_HOME
py.test portal/tests/description_tests.py

Feedback

Feel free to give feedback using GitHub issues or get in touch using the Contact form on our website.

Technology overview

Python

Javascript

CSS

Testing

Other