def test_should_retrieve_a_list_of_boards(get_me, get_boards): # Arrange test_boards = [{'id': '1', 'name': 'Board 1'}] get_me.return_value = GET_ME_RETURN_VALUE get_boards.return_value = test_boards client = MondayClient(USERNAME, '', '') # Act boards = client.get_boards() # Assert ok_(boards != None) eq_(len(boards), 1) eq_(boards[0].id, test_boards[0]['id']) eq_(boards[0].name, test_boards[0]['name'])
def test_should_add_subscribers(add_subscribers_to_board, get_boards, get_me): # Arrange user_id = '1' name = 'name' get_me.return_value = GET_ME_RETURN_VALUE get_boards.return_value = [{'id': '1', 'name': 'name'}] add_subscribers_to_board.return_value = [{'id': user_id, 'name': name}] client = MondayClient(USERNAME, '', '') board = client.get_boards(ids=['1'])[0] # Act subscribers = board.add_subscribers([user_id]) # Assert ok_(subscribers) eq_(subscribers[0].id, user_id) eq_(subscribers[0].name, name)
def test_should_get_activity_logs(get_boards, get_me): # Arrange id = '12345' account_id = '123456' get_me.return_value = GET_ME_RETURN_VALUE get_boards.return_value = [{'id': '1', 'name': 'Test Board 1'}] client = MondayClient(USERNAME, '', '') board = client.get_boards(ids=['1'])[0] get_boards.return_value = [{'id': '1', 'name': 'Test Board 1', 'activity_logs': [{'id': id, 'account_id': account_id}]}] # Act activity_logs = board.get_activity_logs() # Assert ok_(activity_logs) eq_(activity_logs[0].id, id) eq_(activity_logs[0].account_id, account_id)
def test_should_get_board_views(get_boards, get_me): # Arrange id = '123' name = 'view' settings_str = 'settings' view_type = 'type' get_me.return_value = GET_ME_RETURN_VALUE get_boards.return_value = [{'id': '1', 'name': 'Test Board 1'}] client = MondayClient(USERNAME, '', '') board = client.get_boards(ids=['1'])[0] get_boards.return_value = [{'id': '1', 'name': 'Test Board 1', 'views': [{'id': id, 'name': name, 'settings_str': settings_str, 'type': view_type}]}] # Act views = board.get_views() # Assert ok_(views) eq_(views[0].id, id) eq_(views[0].name, name) eq_(views[0].settings_str, settings_str) eq_(views[0].type, view_type)