from flexoentity import FlexoCollection, Domain


def test_collection_basic():
    c = FlexoCollection()
    assert len(c) == 0

    e1 = Domain.with_domain_id("WIP_TEST")
    e2 = Domain.with_domain_id("TEST_WIP")

    c.add(e1)
    c.add(e2)

    assert len(c) == 2
    assert e1.flexo_id in c
    assert c.get(e1.flexo_id) is e1

    c.remove(e1.flexo_id)
    assert len(c) == 1
