def test_should_fail_to_retrieve_single_board_due_to_too_many_parameters(
        get_me):

    # Arrange
    get_me.return_value = GET_ME_RETURN_VALUE
    client = MondayClient(USERNAME, '', '')

    # Act
    client.get_board(id='1', name='Test Board 1')
示例#2
0
def process_updates(jobs, board_name='Jobs'):
    client = MondayClient('*****@*****.**', TOKEN, TOKEN)
    board = client.get_board(name=board_name)

    count = 0
    for group in board.get_groups():
        if group.title in SKIP_GROUPS:
            continue

        for item in group.get_items():
            if item.name in jobs:
                print('\r[{}] Updating: {}'.format(count, item.name), end='')

                update_vals = list()
                for k, v in jobs[item.name].items():
                    col_id, col_type = col_map[k]

                    if v is None:
                        kwargs = {}
                    elif col_type is ColumnType.date:
                        kwargs = {'date': v.date().isoformat()}
                    else:
                        kwargs = {'value': v}

                    col = create_column_value(col_id, col_type, **kwargs)

                    update_vals.append(col)

                item.change_multiple_column_values(column_values=update_vals)
                logger.info("Updating {}: {}".format(item.name,
                                                     log_vals(update_vals)))
                count += 1
            else:
                logger.info("Not in active jobs: {}".format(item.name))
    print('\n')
def test_should_retrieve_a_board_by_id(get_me, get_boards):

    # Arrange
    id = '1'
    name = 'Test Board 1'
    get_me.return_value = GET_ME_RETURN_VALUE
    get_boards.return_value = [{'id': id, 'name': name}]
    client = MondayClient(USERNAME, '', '')

    # Act
    board = client.get_board(id=id)

    # Assert
    ok_(board != None)
    eq_(board.id, id)
    eq_(board.name, name)
def test_should_retrieve_a_board_by_name(get_me, get_board_by_id, get_boards):

    # Arrange
    id = '2'
    name = 'Test Board 2'
    get_me.return_value = GET_ME_RETURN_VALUE
    get_boards.return_value = [{
        'id': '1',
        'name': 'Test Board 1'
    }, {
        'id': id,
        'name': name
    }]
    get_board_by_id.return_value = en.Board(creds={}, id=id, name=name)
    client = MondayClient(USERNAME, '', '')

    # Act
    board = client.get_board(name=name)

    # Assert
    ok_(board != None)
    eq_(board.id, id)
    eq_(board.name, name)
示例#5
0
#!/usr/local/bin/python3
from moncli import MondayClient
from moncli import BoardKind
from moncli import ColumnType

# Instantiating a new client interface to Monday.com
client = MondayClient(user_name='*****@*****.**', api_key_v1='eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjkxNTcxMzE0LCJ1aWQiOjE3Mjk4ODA2LCJpYWQiOiIyMDIwLTExLTIxVDE0OjQzOjE5LjAwMFoiLCJwZXIiOiJtZTp3cml0ZSJ9.G7UsLWL1XKlmClx5lFMxLK_yYG8f2WslO9idr3li09Y', api_key_v2='eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjkxNTcxMzE0LCJ1aWQiOjE3Mjk4ODA2LCJpYWQiOiIyMDIwLTExLTIxVDE0OjQzOjE5LjAwMFoiLCJwZXIiOiJtZTp3cml0ZSJ9.G7UsLWL1XKlmClx5lFMxLK_yYG8f2WslO9idr3li09Y')

# Creating a new board in the Main Workspace
board_name = 'New Public Board'
board_kind = BoardKind.public
new_board = client.create_board(board_name, board_kind)

# Getting a board by it's ID
board_id = '881643972'
board_by_id = client.get_board(id=board_id)

# Getting a board by it's name (this does not work well as it is not native to Monday)
# board_name = 'Hack Tasks'
# retrieved_board = client.get_board(name=board_name)

# Archiving a board
# archived_board = client.archive_board(board_id)

# Add a new column to the board
new_column = board.add_column(title='New Text Column', column_type=ColumnType.text)

# Retrieving Columns from a board
columns = board.get_columns('id', 'title', 'type')

# Retrieving Groups from a board