Пример #1
0
def test_member_comparison():
    member_dict = {
        "first_name": "Arthur",
        "last_name": "Dent",
        "email": "*****@*****.**",
        "phone": "912340042",
    }
    member_1 = Member.from_dict(member_dict)
    member_2 = Member.from_dict(member_dict)

    assert member_1 == member_2
Пример #2
0
def member():
    member_dict = {
        "first_name": "Arthur",
        "last_name": "Dent",
        "email": "*****@*****.**",
        "phone": "912340042",
    }
    return Member.from_dict(member_dict)
Пример #3
0
def test_member_repr():
    member = Member(
        first_name="Arthur",
        last_name="Dent",
        email="*****@*****.**",
        phone="912340042",
    )
    assert repr(member) == f"<Member: {member.first_name} {member.last_name}>"
Пример #4
0
    def execute(self, request):
        from asociate.entities.member import Member

        try:
            self.repo.add_member(request.association_code, request.member)
            return ResponseSuccess(value=Member.from_dict(request.member))
        except Exception as exc:
            return ResponseFailure(exc)
Пример #5
0
def test_member_full_name():
    member_dict = {
        "first_name": "Arthur",
        "last_name": "Dent",
        "email": "*****@*****.**",
        "phone": "912340042",
    }
    member = Member.from_dict(member_dict)

    assert member.full_name == "Arthur Dent"
Пример #6
0
def members(member):
    other_member_dict = {
        "first_name": "Ford",
        "last_name": "Prefect",
        "email": "*****@*****.**",
        "phone": "912340042",
    }
    other_member = Member.from_dict(other_member_dict)

    return [member, other_member]
Пример #7
0
def test_member_model_to_dict():
    member_dict = {
        "first_name": "Arthur",
        "last_name": "Dent",
        "email": "*****@*****.**",
        "phone": "912340042",
        "active": False,
    }
    member = Member.from_dict(member_dict)

    assert member.to_dict() == member_dict
Пример #8
0
def test_member_init():
    member = Member(
        first_name="Arthur",
        last_name="Dent",
        email="*****@*****.**",
        phone="912340042",
    )
    assert member.first_name == "Arthur"
    assert member.last_name == "Dent"
    assert member.email == "*****@*****.**"
    assert member.phone == "912340042"
Пример #9
0
def test_member_init_from_dict():
    member_dict = {
        "first_name": "Arthur",
        "last_name": "Dent",
        "email": "*****@*****.**",
        "phone": "912340042",
    }
    member = Member.from_dict(member_dict)

    assert member.first_name == "Arthur"
    assert member.last_name == "Dent"
    assert member.email == "*****@*****.**"
    assert member.phone == "912340042"