def test_owners_creation(users):
    user = users[0]
    owner1 = Owner({"user": user.id})
    owner2 = Owner(user)
    owner3 = Owner({"user": 1337})
    owners = Owners([owner1, owner2, owner1])
    assert len(owners) == 1
    owners.add(owner3)
    assert len(owners) == 2
    owners.add(owner3)
    assert len(owners) == 2
    owners.add(user)
    assert len(owners) == 2
def test_owner_creation(users):
    user = users[0]
    owner1 = Owner({"user": user.id})
    owner2 = Owner(user)
    assert owner1.owner_id == owner2.owner_id == user.id
    assert owner1.owner_type == owner2.owner_type == "user"
    assert owner1.dump() == owner2.dump()
def test_owner_dump():
    dict_ = {"user": 1}
    owner = Owner(dict_)
    assert owner.dump() == dict_
def test_owner_resolve_invalid():
    owner = Owner({"user": -1})
    with pytest.raises(LookupError):
        assert owner.resolve(raise_exc=True)
def test_owner_resolve(users):
    user = users[0]
    owner = Owner({"user": user.id})
    assert owner.resolve() == user