Ejemplo n.º 1
0
def test_user_should_send_a_notification(create_notification, get_users, get_me):

    # Arrange 
    get_me.return_value = GET_ME_RETURN_VALUE
    get_users.return_value = [{'id': '1', 'email': '*****@*****.**'}]
    create_notification.return_value = {'id': '1', 'text': 'Text 1'}
    client = MondayClient(USERNAME, '', '')
    user = client.get_users()[0]

    # Act 
    notification = user.send_notification('Text 1', '2', NotificationTargetType.Post)

    # Assert
    ok_(notification != None)
    ok_(notification.text, 'Text 1')
Ejemplo n.º 2
0
def test_user_should_get_the_account(get_users, get_me):

    # Arrange
    get_me.return_value = GET_ME_RETURN_VALUE
    get_users.return_value = [{'id': '1', 'email': '*****@*****.**'}]
    client = MondayClient(USERNAME, '', '')
    user = client.get_users()[0]

    get_users.return_value = [{'id': '1', 'account': {'id': '1', 'name': 'Account 1', 'first_day_of_the_week': None, 'show_timeline_weekends': None, 'slug': None}}]

    # Act
    account = user.get_account()

    # Assert
    ok_(account != None)
    eq_(account.name, 'Account 1')
Ejemplo n.º 3
0
def test_user_should_get_teams(get_users, get_me):

    # Arrange
    get_me.return_value = GET_ME_RETURN_VALUE
    get_users.return_value = [{'id': '1', 'email': '*****@*****.**'}]
    client = MondayClient(USERNAME, '', '')
    user = client.get_users()[0]

    get_users.return_value = [{'id': '1', 'teams': [{'id': '1', 'name': 'Team 1'}]}]

    # Act
    teams = user.get_teams()

    # Assert
    ok_(teams != None)
    eq_(len(teams), 1)
    eq_(teams[0].name, 'Team 1')
Ejemplo n.º 4
0
def test_should_retrieve_list_of_users(get_me, get_users):

    # Arrange
    name = 'User 1'
    email = '*****@*****.**'
    get_me.return_value = GET_ME_RETURN_VALUE
    get_users.return_value = [{'id': '1', 'name': name, 'email': email}]
    client = MondayClient(USERNAME, '', '')

    # Act
    users = client.get_users()

    # Assert
    ok_(users != None)
    eq_(len(users), 1)
    eq_(users[0].name, name)
    eq_(users[0].email, email)