6.1. Integration Tests

The purpose of these tests is to test server functionality without mocking. These tests are not so much about attaining code coverage, as they are about ensuring that OmicronServer “plays nice” with other components.

6.1.1. Test Database Round-Trip

Tests that the server can successfully write and read from the database in a “Round Trip”

class tests.integration.test_database_roundtrip.TestDatabaseRoundTrip(methodName='runTest')[source]

Tests that SQLAlchemy is successfully able to connect to the database, store an object in the DB, and retrieve it successfully.

test_write()[source]

Tests the round trip

6.1.2. Test Auth

Contains integration tests for auth, performing authentication without stubbing out any functionality.

class tests.integration.test_auth.TestAuth(methodName='runTest')[source]

Base class for testing auth

classmethod setUpClass()[source]

Set up the test database, and put the server into a request context requiring authentication.

classmethod tearDownClass()[source]

Clean up a test suite by dropping all tables in the test database.

class tests.integration.test_auth.TestVerifyPassword(methodName='runTest')[source]

Tests the auth.verify_password() callback

test_verify_correct_uname_bad_pwd()[source]

Tests that the callback returns False if the correct username but an incorrect password are supplied.

test_verify_incorrect_username_correct_pwd()[source]

Tests that the callback returns False if an incorrect username but correct password are supplied.

test_verify_password_correct_credentials()[source]

Tests that the callback returns True if the correct username and password are provided.

class tests.integration.test_auth.TestVerifyToken(methodName='runTest')[source]

Tests auth._verify_token()

setUp()[source]

Starts up the server, and requests an authentication token using the correct login credentials.

test_token_auth()[source]

Tests that the verify_password callback can authenticate a user when the correct token is provided.

test_token_auth_bad_token()[source]

Tests that the user cannot be authenticated if an incorrect token is provided.