Example #1
0
class BaseApiTest(unittest.TestCase):

    tc = app.test_client()

    def init(self):
        """
        Call in the setUp function
        
        Disables Flask removing the session between requests
        """

        # Prevent Flask-SQLAlchemy from removing session after each request
        def do_nothing():
            pass

        self.old_db_session_remove = db.session.remove
        db.session.remove = do_nothing

    def cleanup(self):
        """
        call in the tearDown function
        
        
        Rolls back and removes session at end of each test
        """
        db.session.rollback()
        self.old_db_session_remove()

    def login(self, login=DBO_USER):
        """
        Logs into the system for edit capabilities
        """
        r = self.tc.post('/login', data=dict(user=login, password=''))
Example #2
0
import test_config

import unittest
from pwi import app

tc = app.test_client()
class ExperimentDetailTestCase(unittest.TestCase):

    # Test the experiment detail blueprint
    def test_experiment_detail_basic_info(self):
        # query for a mapping experiment
        r = tc.get('/detail/experiment/MGI:39529')
        
        # check  mgiid
        assert 'MGI:39529' in r.data, "check MGI ID"
        # check reference
        assert 'J:9342' in r.data, "check experiment reference"
        # check reference note
        assert 'Revised gene symbols' in r.data, "check Reference Experiment Note"
         # check experiment type
        assert 'TEXT-Genetic Cross' in r.data, "check experiment type"
         # check chromosome
        assert '1' in r.data, "check chromosome"
         # check experiment note
        assert 'Supporting data is reported elsewhere' in r.data, "check experiment note"
        
    def test_experiment_detail_marker_table(self):
        # query for a mapping experiment
        r = tc.get('/detail/experiment/MGI:39529')
        
        # check marker symbol