示例#1
0
        room.set_attribute_value(u'foo', value)
        expected.add((room, value))
    assert set(Room.find_with_attribute(u'foo')) == expected


def test_get_with_data_errors():
    with pytest.raises(ValueError):
        Room.get_with_data(foo='bar')


@pytest.mark.parametrize(
    ('only_active', 'data'),
    list(
        itertools.product(
            (True, False),
            powerset(('equipment', 'vc_equipment', 'non_vc_equipment')))))
def test_get_with_data(db, create_room, create_equipment_type, only_active,
                       data):
    eq = create_equipment_type(u'eq')
    vc = create_equipment_type(u'Video conference')
    vc1 = create_equipment_type(u'vc1')
    vc2 = create_equipment_type(u'vc2')
    vc.children.append(vc1)
    vc.children.append(vc2)

    rooms = {
        'inactive': {
            'room': create_room(is_active=False),
            'equipment': set(),
            'vc_equipment': set(),
            'non_vc_equipment': set()
示例#2
0
    expected = set()
    for room in [create_room(), create_room()]:
        value = u'bar-{}'.format(room.id)
        room.set_attribute_value(u'foo', value)
        expected.add((room, value))
    assert set(Room.find_with_attribute(u'foo')) == expected


def test_get_with_data_errors():
    with pytest.raises(ValueError):
        Room.get_with_data(foo='bar')


@pytest.mark.parametrize(('only_active', 'data'), list(itertools.product(
    (True, False),
    powerset(('equipment', 'vc_equipment', 'non_vc_equipment'))
)))
def test_get_with_data(db, create_room, create_equipment_type, only_active, data):
    eq = create_equipment_type(u'eq')
    vc = create_equipment_type(u'Video conference')
    vc1 = create_equipment_type(u'vc1')
    vc2 = create_equipment_type(u'vc2')
    vc.children.append(vc1)
    vc.children.append(vc2)

    rooms = {
        'inactive': {'room': create_room(is_active=False),
                     'equipment': set(),
                     'vc_equipment': set(),
                     'non_vc_equipment': set()},
        'no_eq': {'room': create_room(),
示例#3
0
    expected = set()
    for room in [create_room(), create_room()]:
        value = u"bar-{}".format(room.id)
        room.set_attribute_value(u"foo", value)
        expected.add((room, value))
    assert set(Room.find_with_attribute(u"foo")) == expected


def test_get_with_data_errors():
    with pytest.raises(ValueError):
        Room.get_with_data(foo="bar")


@pytest.mark.parametrize(
    ("only_active", "data"),
    list(itertools.product((True, False), powerset(("equipment", "vc_equipment", "non_vc_equipment")))),
)
def test_get_with_data(db, create_room, create_equipment_type, only_active, data):
    eq = create_equipment_type(u"eq")
    vc = create_equipment_type(u"Video conference")
    vc1 = create_equipment_type(u"vc1")
    vc2 = create_equipment_type(u"vc2")
    vc.children.append(vc1)
    vc.children.append(vc2)

    rooms = {
        "inactive": {
            "room": create_room(is_active=False),
            "equipment": set(),
            "vc_equipment": set(),
            "non_vc_equipment": set(),