コード例 #1
0
ファイル: user_test.py プロジェクト: twof/beans
def test_sync_creates_new_employee(database, data_source):
    """
    Data source contains a user that we don't have in our database,
    we must create a new user in our database.
    """
    sync_employees(data_source)
    user = User.query.filter(User.email == '*****@*****.**').one()
    assert user.first_name == 'Sam'
コード例 #2
0
ファイル: user_test.py プロジェクト: twof/beans
def test_sync_marks_employee_as_terminated(database, data_source):
    """
    Data source contains a list of active users for beans.  If the user
    is not present in the data source, but present in our database we

    mark the employee as terminated
    """
    sync_employees(data_source)
    user = User.query.filter(User.email == '*****@*****.**').one()
    assert not user.terminated

    sync_employees({})
    user = User.query.filter(User.email == '*****@*****.**').one()
    assert user.terminated
コード例 #3
0
ファイル: user_test.py プロジェクト: twof/beans
def test_sync_updates_current_employee(database, data_source):
    """
    Data source contains a user that we are already tracking in our database,
    we must update the user in the database to reflect new information.
    Returns
    """
    sync_employees(data_source)
    user = User.query.filter(User.email == '*****@*****.**').one()
    assert user.first_name == 'Sam'
    assert user.meta_data['department'] == 'Engineering'

    data = data_source[0]
    data['first_name'] = 'John'
    data['department'] = 'Design'
    data['metadata']['department'] = 'Design'
    sync_employees(data_source)
    user = User.query.filter(User.email == '*****@*****.**').one()
    assert user.first_name == 'John'
    assert user.meta_data['department'] == 'Design'
コード例 #4
0
ファイル: tasks.py プロジェクト: stanleynwang/beans
def populate_employees():
    employees = DataIngestion().ingest()
    sync_employees([employee for employee in employees])
    return "OK"
コード例 #5
0
ファイル: tasks.py プロジェクト: bxm156/beans
def populate_users_from_s3():
    sync_employees([employee for employee in get_json_employee_data()])
    return "OK"