コード例 #1
0
    def setUp(self):
        TestTokens.setUp(self)
        self.session = mock.MagicMock(spec=ContextManagedSession())

        self.token = mock.MagicMock()

        self.endpoint.make_400_error_response = mock.MagicMock()
        self.error_message = 'This is an error'
コード例 #2
0
 def setUp(self):
     """
     Create an engine for a SQLlite in-memory DB, and create a
     :class:`ContextManagedSession` to test on
     """
     TestCaseWithAppContext.setUp(self)
     self.engine = create_engine('sqlite:///')
     self.base_session = ContextManagedSession(bind=self.engine)
コード例 #3
0
Contains integration tests for :mod:`auth`, performing authentication
without stubbing out any functionality.
"""
import json
from base64 import b64encode
from uuid import uuid4
import omicron_server.auth as auth
from omicron_server.database import ContextManagedSession
from omicron_server.models import User
from omicron_server.config import default_config as conf
from tests.integration import TestCaseWithDatabase
from omicron_server import app
from copy import deepcopy

__author__ = 'Michal Kononenko'
database_session = ContextManagedSession(bind=conf.DATABASE_ENGINE)


class TestAuth(TestCaseWithDatabase):
    """
    Base class for testing :mod:`auth`
    """
    @classmethod
    def setUpClass(cls):
        """
        Set up the test database, and put the server into a request context
        requiring authentication.
        """
        TestCaseWithDatabase.setUpClass()
        cls.username = '******'
        cls.password = '******'