Esempio n. 1
0
    def test_get_all_invitations_failure(self, user, session):
        invitations = get_all_invitations(unknown_parameter=user,
                                          session=session)
        assert invitations == []

        invitations = get_all_invitations(recipient=None, session=session)
        assert invitations == []
Esempio n. 2
0
 def test_send_in_app_invitation_success(self, user, sender, event,
                                         session):
     assert send_in_app_invitation([user.email], event, session=session)
     invitation = get_all_invitations(session=session, recipient=user)[0]
     assert invitation.event.owner == sender
     assert invitation.recipient == user
     session.delete(invitation)
Esempio n. 3
0
def create_data(session):
    _ = [
        create_user("user" + str(_), "password" + str(_),
                    "email" + str(_) + '@' + 'gmail.com', "Hebrew", session)
        for _ in range(1, 4)
    ]
    start = datetime.datetime.now() + datetime.timedelta(hours=-1)
    end = datetime.datetime.now() + datetime.timedelta(hours=1)
    create_events_and_user_events(session, start, end, 1,
                                  ["*****@*****.**", "*****@*****.**"])
    start = datetime.datetime.now() + datetime.timedelta(days=-1)
    end = datetime.datetime.now() + datetime.timedelta(days=-1, hours=2)
    create_events_and_user_events(session, start, end, 1,
                                  ["*****@*****.**", "*****@*****.**"])
    start = datetime.datetime.now() + datetime.timedelta(hours=1)
    end = datetime.datetime.now() + datetime.timedelta(hours=1.5)
    create_events_and_user_events(session, start, end, 2, ["*****@*****.**"])
    for invitation in get_all_invitations(session):
        accept(invitation, session)
Esempio n. 4
0
 def test_get_all_invitations_success(invitation, event, user, session):
     invitations = get_all_invitations(event=event, db=session)
     assert invitations == [invitation]
     invitations = get_all_invitations(recipient=user, db=session)
     assert invitations == [invitation]
Esempio n. 5
0
 def test_share_success(self, user, event, session):
     participants = [user.email]
     share(event, participants, session)
     invitations = get_all_invitations(session=session,
                                       recipient_id=user.id)
     assert invitations != []
Esempio n. 6
0
 def test_share_failure(self, event, session):
     participants = [event.owner.email]
     share(event, participants, session)
     invitations = get_all_invitations(session=session,
                                       recipient_id=event.owner.id)
     assert invitations == []