Example #1
0
    def testReopenChallenge(self):
        self.a.inviteFriend('me', '*****@*****.**', 'youyou', [self.a_list])

        challenge = self.b.openChallenge()

        # if someone else opens this page, he/she gets logged in
        o = uts.SouhaitUser()
        try:
            o.open(raw=challenge)
            assert o.location() == uts.url('/')
        finally:
            o.stop()
Example #2
0
    def testFriendCanInvite(self):
        # now, b is a friend of a
        self.b.open('/liste-a')

        # check that b can invite for list a
        self.b.inviteFriend('me', '*****@*****.**', 'blah', [self.a_list])

        o = uts.SouhaitUser()
        try:
            o.openChallenge()
            o_user = self.srv.getUserByEmail('*****@*****.**')
            assert [lst.id for lst, _ in self.srv.getFriendLists(o_user)] == \
                   [self.a_list.id]
        finally:
            o.stop()
Example #3
0
    def testInviteUnknownPerson(self):
        """ Send an invitation to someone that never used the site."""

        srv = core.Service(uts.url())
        srv.startService()

        list_id = srv.getListByURL(self.u_list)

        self.u.inviteFriend('me', '*****@*****.**', 'youyou', [list_id])
        o = uts.SouhaitUser()
        try:
            o.openChallenge()
        finally:
            o.stop()

        # the person should have a home page with a link to a's list
        u = srv.getUserByEmail('*****@*****.**')

        # We only keep the list info, not the freshness
        friends = [l[0] for l in srv.getFriendLists(u)]
        assert friends == [list_id]
Example #4
0
    def testListMerging(self):
        # user b has a wish in his list
        self.u.open('/' + self.u_list)
        self.u.createItem(title='A test',
                          description='blah...',
                          url='http://www/')

        # user a logs in and visits list b
        a = uts.SouhaitUser()
        a.open()
        a.siteLogin('*****@*****.**')
        a.openChallenge()
        a.open('/' + self.u_list)

        srv = core.Service(uts.url())
        srv.startService()

        a_id = srv.getUserByEmail('*****@*****.**')

        try:
            self.cu.execute('SELECT COUNT (*) FROM friend WHERE user = ?',
                            (a_id.id, ))
            assert self.cu.fetchone()[0] == 1

            # a logs out, comes back to the list of b, logs in, visits the
            # page and confirms her identity after that.
            a.siteLogout()
            a.siteLogin('*****@*****.**')
            a.openChallenge()

            # we should not have a duplicate
            self.cu.execute('SELECT COUNT (*) FROM friend WHERE user = ?',
                            (a_id.id, ))
            assert self.cu.fetchone()[0] == 1

        finally:
            a.stop()
Example #5
0
 def setup_class(cls):
     cls.u = uts.SouhaitUser()
Example #6
0
 def setup_class(cls):
     cls.a = uts.SouhaitUser()
     cls.b = uts.SouhaitUser()
Example #7
0
    def setup_method(self, m):
        self.cx = uts.resetDB()
        self.cu = self.cx.cursor()
        uts.resetMail()

        self.u = uts.SouhaitUser()