Add end-to-end test for team sync
This commit is contained in:
parent
4055158fc4
commit
96b9d6b0cd
2 changed files with 16 additions and 2 deletions
|
@ -9,6 +9,8 @@ from data.users.teamsync import sync_team, sync_teams_to_groups
|
|||
from endpoints.test.fixtures import app, appconfig, database_uri, init_db_path, sqlitedb_file
|
||||
from util.names import parse_robot_username
|
||||
|
||||
from test.test_ldap import mock_ldap
|
||||
|
||||
_FAKE_AUTH = 'fake'
|
||||
|
||||
class FakeUsers(FederatedUsers):
|
||||
|
@ -218,3 +220,15 @@ def test_sync_teams_to_groups(app):
|
|||
|
||||
fourth_sync_info = model.team.get_team_sync_information('buynlarge', 'synced')
|
||||
assert fourth_sync_info.transaction_id != updated_sync_info.transaction_id
|
||||
|
||||
|
||||
@pytest.mark.parametrize('auth_system_builder', [
|
||||
mock_ldap,
|
||||
])
|
||||
def test_teamsync_end_to_end(auth_system_builder, app):
|
||||
# Assert the team has not yet been updated.
|
||||
sync_team_info = model.team.get_team_sync_information('buynlarge', 'synced')
|
||||
assert sync_team_info.last_updated is None
|
||||
|
||||
with auth_system_builder() as auth:
|
||||
assert sync_team(auth, sync_team_info)
|
||||
|
|
|
@ -7,14 +7,14 @@ import requests
|
|||
from flask import Flask, request, abort, make_response
|
||||
from contextlib import contextmanager
|
||||
|
||||
from helpers import liveserver_app
|
||||
from test.helpers import liveserver_app
|
||||
from data.users.keystone import get_keystone_users
|
||||
from initdb import setup_database_for_testing, finished_database_for_testing
|
||||
|
||||
_PORT_NUMBER = 5001
|
||||
|
||||
@contextmanager
|
||||
def fake_keystone(version, requires_email=True):
|
||||
def fake_keystone(version=3, requires_email=True):
|
||||
""" Context manager which instantiates and runs a webserver with a fake Keystone implementation,
|
||||
until the result is yielded.
|
||||
|
||||
|
|
Reference in a new issue