Ejemplo n.º 1
0
    def test_get_for_clan(self):
        result, account_id, bundle_id = register_user('test_user_2', '*****@*****.**', '111111')
        account_2 = AccountPrototype.get_by_id(account_id)

        result, account_id, bundle_id = register_user('test_user_3', '*****@*****.**', '111111')
        account_3 = AccountPrototype.get_by_id(account_id)

        result, account_id, bundle_id = register_user('test_user_4', '*****@*****.**', '111111')
        account_4 = AccountPrototype.get_by_id(account_id)

        result, account_id, bundle_id = register_user('test_user_5', '*****@*****.**', '111111')
        account_5 = AccountPrototype.get_by_id(account_id)

        result, account_id, bundle_id = register_user('test_user_6', '*****@*****.**', '111111')
        account_6 = AccountPrototype.get_by_id(account_id)

        clan_1 = self.create_clan(self.account, 0)
        clan_2 = self.create_clan(account_4, 1)

        MembershipRequestPrototype.create(initiator=self.account,
                                          account=account_2,
                                          clan=clan_1,
                                          text=u'invite-1',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        request = MembershipRequestPrototype.create(initiator=account_3,
                                                    account=account_3,
                                                    clan=clan_1,
                                                    text=u'invite-2',
                                                    type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(initiator=account_5,
                                          account=account_5,
                                          clan=clan_2,
                                          text=u'invite-3',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(initiator=account_4,
                                          account=account_6,
                                          clan=clan_2,
                                          text=u'invite-4',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        self.assertEqual(set(request.id for request in MembershipRequestPrototype.get_for_clan(clan_1.id)),
                         set([request.id]))
Ejemplo n.º 2
0
    def test_get_for_clan(self):
        account_2 = self.accounts_factory.create_account()
        account_3 = self.accounts_factory.create_account()
        account_4 = self.accounts_factory.create_account()
        account_5 = self.accounts_factory.create_account()
        account_6 = self.accounts_factory.create_account()

        clan_1 = self.create_clan(self.account, 0)
        clan_2 = self.create_clan(account_4, 1)

        MembershipRequestPrototype.create(
            initiator=self.account,
            account=account_2,
            clan=clan_1,
            text='invite-1',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        request = MembershipRequestPrototype.create(
            initiator=account_3,
            account=account_3,
            clan=clan_1,
            text='invite-2',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(
            initiator=account_5,
            account=account_5,
            clan=clan_2,
            text='invite-3',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(
            initiator=account_4,
            account=account_6,
            clan=clan_2,
            text='invite-4',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        self.assertEqual(
            set(request.id for request in
                MembershipRequestPrototype.get_for_clan(clan_1.id)),
            set([request.id]))
Ejemplo n.º 3
0
    def test_get_for_clan(self):
        account_2 = self.accounts_factory.create_account()
        account_3 = self.accounts_factory.create_account()
        account_4 = self.accounts_factory.create_account()
        account_5 = self.accounts_factory.create_account()
        account_6 = self.accounts_factory.create_account()

        clan_1 = self.create_clan(self.account, 0)
        clan_2 = self.create_clan(account_4, 1)

        MembershipRequestPrototype.create(initiator=self.account,
                                          account=account_2,
                                          clan=clan_1,
                                          text='invite-1',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        request = MembershipRequestPrototype.create(initiator=account_3,
                                                    account=account_3,
                                                    clan=clan_1,
                                                    text='invite-2',
                                                    type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(initiator=account_5,
                                          account=account_5,
                                          clan=clan_2,
                                          text='invite-3',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(initiator=account_4,
                                          account=account_6,
                                          clan=clan_2,
                                          text='invite-4',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        self.assertEqual(set(request.id for request in MembershipRequestPrototype.get_for_clan(clan_1.id)),
                         set([request.id]))