示例#1
0
def test_should_retrieve_a_list_of_items_by_column_value(
        get_items_by_column_values, create_board, get_me):

    # Arrange
    board_id = '1'
    name = 'Item 1'
    get_me.return_value = GET_ME_RETURN_VALUE
    create_board.return_value = {'id': board_id, 'name': 'Test Board 1'}
    get_items_by_column_values.return_value = [{
        'id': '1',
        'name': name,
        'board': {
            'id': board_id
        }
    }]
    client = e.client.MondayClient(USERNAME, '', '')
    board = client.create_board('Test Board 1', BoardKind.public)

    # Act
    column_value = cv.create_column_value('text_column_01',
                                          ColumnType.text,
                                          value='Some Value')
    items = board.get_items_by_column_values(column_value)

    # Assert
    ok_(items != None)
    eq_(len(items), 1)
    eq_(items[0].name, name)
示例#2
0
def test_should_return_status_column_value_by_label_with_preference():

    # Arrange
    id = 'status_4'
    column_type = ColumnType.status
    title = 'Status Four'
    label = 'Status 4'

    # Act
    column_value = create_column_value(
        id,
        column_type,
        title,
        label=label,
        index=3,
        settings=o.StatusSettings(**{'labels': {
            '4': "Status 4"
        }}))
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.index, 4)
    eq_(column_value.label, label)
    eq_(format, {'label': label})
示例#3
0
def test_board_should_create_an_item_with_list_column_values(
        create_item, create_board, get_me):

    # Arrange
    board_id = '3'
    name = 'Item 4'
    group_id = 'group2'
    get_me.return_value = GET_ME_RETURN_VALUE
    create_board.return_value = {'id': board_id, 'name': 'Test Board 1'}
    create_item.return_value = {
        'id': '4',
        'name': name,
        'board': {
            'id': board_id
        }
    }
    client = e.client.MondayClient(USERNAME, '', '')
    board = client.create_board('Test Board 1', BoardKind.public)
    status_column = cv.create_column_value(
        'status',
        ColumnType.status,
        'Status',
        index=0,
        settings=e.objects.StatusSettings(labels={'0': 'Test'}))

    # Act
    item = board.add_item(name,
                          group_id=group_id,
                          column_values=[status_column])

    # Assert
    ok_(item != None)
    eq_(item.name, name)
示例#4
0
def test_should_fail_for_non_writeable_column_type():

    # Arrange
    id = 'test_id'
    column_type = ColumnType.auto_number
    title = 'should fail'

    # Act
    column_value = create_column_value(id, column_type, title)
    column_value.format()
示例#5
0
def test_should_return_an_empty_number_column_value():

    # Arrange
    id = 'number_0'
    column_type = ColumnType.numbers
    title = 'Number 0'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.number, None)
    eq_(format, '')
示例#6
0
def test_should_return_checked_checkbox_column_value():

    # Arrange
    id = 'checkbox_2'
    column_type = ColumnType.checkbox
    title = 'Checkbox'

    # Act
    column_value = create_column_value(id, column_type, title, checked='true')
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.checked, True)
    eq_(format, {'checked': 'true'})
示例#7
0
def test_should_return_empty_rating_column_value():

    # Arrange
    id = 'rating_1'
    column_type = ColumnType.rating
    title = 'Rating One'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.rating, None)
    eq_(format, {})
示例#8
0
def test_should_return_an_empty_checkbox_column_value():

    # Arrange
    id = 'checkbox_1'
    column_type = ColumnType.checkbox
    title = 'Checkbox'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.checked, False)
    eq_(format, {})
示例#9
0
def test_should_return_empty_timezone_column_value():

    # Arrange
    id = 'timezone_1'
    column_type = ColumnType.world_clock
    title = 'Time zone 1'
    
    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.timezone, None)
    eq_(format, {})
示例#10
0
def test_should_return_an_empty_people_column_value():

    # Arrange
    id = 'people_0'
    column_type = ColumnType.people
    title = 'People 0'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.persons_and_teams, None)
    eq_(format, {})
示例#11
0
def test_should_return_empty_text_column_value():

    # Arrange
    id = 'text_1'
    column_type = ColumnType.text
    title = 'Text 1'
    
    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.text, None)
    eq_(format, '')
示例#12
0
def test_should_return_an_empty_long_text_column_value():

    # Arrange
    id = 'long_text_0'
    column_type = ColumnType.long_text
    title = 'Long Test 0'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.text, None)
    eq_(format, {})
示例#13
0
def test_should_return_empty_tags_column_value():

    # Arrange
    id = 'tags_1'
    column_type = ColumnType.tags
    title = 'Tags 1'
    
    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.tag_ids, None)
    eq_(format, {'tag_ids': []})
示例#14
0
def test_should_return_long_text_column_value_with_text():

    # Arrange
    id = 'long_text_1'
    column_type = ColumnType.long_text
    title = 'Long Test 1'
    text = 'LOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG'

    # Act
    column_value = create_column_value(id, column_type, title, text=text)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.text, text)
    eq_(format, {'text': text})
示例#15
0
def test_should_return_text_column_value_with_text():

    # Arrange
    id = 'text_2'
    column_type = ColumnType.text
    title = 'Text 2'
    text = 'Hello, Grandma!'
    
    # Act
    column_value = create_column_value(id, column_type, title, value=text)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.text, text)
    eq_(format, text)
示例#16
0
def test_should_return_team_column_value_with_team_id():

    # Arrange
    id = 'team_2'
    column_type = ColumnType.team
    title = 'Team 2'
    team_id = 12345
    
    # Act
    column_value = create_column_value(id, column_type, title, team_id=team_id)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.team_id, team_id)
    eq_(format, {'team_id': team_id})
示例#17
0
def test_should_return_tags_column_value_with_tag_ids():

    # Arrange
    id = 'tags_2'
    column_type = ColumnType.tags
    title = 'Tags 2'
    tag_ids = [1,2,3]
    
    # Act
    column_value = create_column_value(id, column_type, title, tag_ids=tag_ids)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.tag_ids, tag_ids)
    eq_(format, {'tag_ids': tag_ids})
示例#18
0
def test_should_return_an_empty_number_column_value_when_input_is_text():

    # Arrange
    id = 'number_x'
    column_type = ColumnType.numbers
    title = 'Number X'
    number = 'x'

    # Act
    column_value = create_column_value(id, column_type, title, value=number)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.number, None)
    eq_(format, '')
示例#19
0
def test_should_return_name_column_value_with_name():

    # Arrange
    id = 'name_1'
    column_type = ColumnType.name
    title = 'Name 1'
    name = 'Name'

    # Act
    column_value = create_column_value(id, column_type, title, value=name)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.name, name)
    eq_(format, name)
示例#20
0
def test_should_return_an_empty_date_column_value():

    # Arrange
    id = 'date_1'
    column_type = ColumnType.date
    title = 'Date'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.date, None)
    eq_(column_value.time, None)
    eq_(format, {})
示例#21
0
def test_should_return_an_empty_phone_column_value():

    # Arrange
    id = 'phone_0'
    column_type = ColumnType.phone
    title = 'Phone Zero'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.phone, None)
    eq_(column_value.country_short_name, None)
    eq_(format, {'phone': '', 'countryShortName': ''})
示例#22
0
def test_should_return_an_empty_country_column_value():

    # Arrange
    id = 'country_1'
    column_type = ColumnType.country
    title = 'Country'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.country_code, None)
    eq_(column_value.country_name, None)
    eq_(format, {})
示例#23
0
def test_should_return_a_people_column_value_with_persons_and_teams():

    # Arrange
    id = 'people_1'
    column_type = ColumnType.people
    title = 'People 1'
    persons_and_teams = [{'id': 1, 'kind': PeopleKind.person}]

    # Act
    column_value = create_column_value(id, column_type, title, persons_and_teams=persons_and_teams)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.persons_and_teams, persons_and_teams)
    eq_(format, {'personsAndTeams': persons_and_teams})
示例#24
0
def test_should_return_timezone_column_value_with_text():

    # Arrange
    id = 'timezone_2'
    column_type = ColumnType.world_clock
    title = 'Timezone 2'
    timezone = 'America/Phoenix'
    
    # Act
    column_value = create_column_value(id, column_type, title, timezone=timezone)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.timezone, timezone)
    eq_(format, {'timezone': timezone})
示例#25
0
def test_should_return_empty_week_column_value():

    # Arrange
    id = 'week_1'
    column_type = ColumnType.week
    title = 'Week 1'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.start_date, None)
    eq_(column_value.end_date, None)
    eq_(format, {})
示例#26
0
def test_should_return_a_number_column_value_with_float():

    # Arrange
    id = 'number_2'
    column_type = ColumnType.numbers
    title = 'Number 2'
    number = 23.333333333

    # Act
    column_value = create_column_value(id, column_type, title, value=number)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.number, number)
    eq_(format, str(number))
示例#27
0
def test_item_should_change_multiple_column_values_with_column_value_list(change_multiple_column_value, get_items, get_me):

    # Arrange
    get_me.return_value = GET_ME_RETURN_VALUE
    get_items.return_value = [{'id': '1', 'name': 'Test Item 01', 'board': {'id': '1'}}]
    change_multiple_column_value.return_value = {'id': '1', 'name': 'Test Item 01', 'board': {'id': '1'}}
    client = e.client.MondayClient(USERNAME, '', '')
    item = client.get_items()[0]

    # Act
    column_value = cv.create_column_value(id='text_column_01', column_type=ColumnType.text, value='Hello, world!')
    item = item.change_multiple_column_values([column_value])

    # Assert 
    ok_(item != None)
    eq_(item.name, 'Test Item 01')
示例#28
0
def test_should_return_empty_status_column_value():

    # Arrange
    id = 'status_1'
    column_type = ColumnType.status
    title = 'Status One'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.index, None)
    eq_(column_value.text, None)
    eq_(format, {'label': ''})
示例#29
0
def test_should_return_a_rating_column_value_with_rating():

    # Arrange
    id = 'rating_2'
    column_type = ColumnType.rating
    title = 'Rating Two'
    rating = 5

    # Act
    column_value = create_column_value(id, column_type, title, rating=rating)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.rating, 5)
    eq_(format, {'rating': rating})
示例#30
0
def test_should_return_empty_link_column_value():

    # Arrange
    id = 'link_1'
    column_type = ColumnType.link
    title = 'Link One'

    # Act
    column_value = create_column_value(id, column_type, title)
    format = column_value.format()

    # Assert
    ok_(column_value != None)
    eq_(column_value.url, None)
    eq_(column_value.text, None)
    eq_(format, {})