예제 #1
0
    def test_request_message(self):
        account_2 = self.accounts_factory.create_account()

        clan_1 = self.create_clan(self.account, 0)

        MembershipRequestPrototype.create(initiator=account_2,
                                          account=account_2,
                                          clan=clan_1,
                                          text='request-1',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)
예제 #2
0
    def test_request_message(self):
        account_2 = self.accounts_factory.create_account()

        clan_1 = self.create_clan(self.account, 0)

        MembershipRequestPrototype.create(initiator=account_2,
                                          account=account_2,
                                          clan=clan_1,
                                          text='request-1',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)
예제 #3
0
    def test_request_message(self):
        result, account_id, bundle_id = register_user('test_user_2', '*****@*****.**', '111111')
        account_2 = AccountPrototype.get_by_id(account_id)

        clan_1 = self.create_clan(self.account, 0)

        MembershipRequestPrototype.create(initiator=account_2,
                                          account=account_2,
                                          clan=clan_1,
                                          text=u'request-1',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)
예제 #4
0
    def test_add_member__remove_membership_requests_when_created(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)

        clan_2 = self.create_clan(account_2, 2)
        clan_3 = self.create_clan(account_3, 3)

        MembershipRequestPrototype.create(initiator=account_4,
                                          account=account_4,
                                          clan=clan_2,
                                          text=u'request',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(initiator=account_3,
                                          account=account_4,
                                          clan=clan_3,
                                          text=u'request',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        request_1 = MembershipRequestPrototype.create(initiator=account_5,
                                                      account=account_5,
                                                      clan=clan_2,
                                                      text=u'request',
                                                      type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        request_2 = MembershipRequestPrototype.create(initiator=account_3,
                                                      account=account_5,
                                                      clan=clan_3,
                                                      text=u'request',
                                                      type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        self.assertEqual(MembershipRequestPrototype._db_count(), 4)

        self.clan.add_member(account_4)

        self.assertEqual(MembershipRequestPrototype._db_count(), 2)
        self.assertEqual(set(r.id for r in MembershipRequestPrototype._db_all()),
                         set((request_1.id, request_2.id)))
예제 #5
0
    def test_add_member__remove_membership_requests_when_created(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()

        clan_2 = self.create_clan(account_2, 2)
        clan_3 = self.create_clan(account_3, 3)

        MembershipRequestPrototype.create(
            initiator=account_4,
            account=account_4,
            clan=clan_2,
            text='request',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(
            initiator=account_3,
            account=account_4,
            clan=clan_3,
            text='request',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        request_1 = MembershipRequestPrototype.create(
            initiator=account_5,
            account=account_5,
            clan=clan_2,
            text='request',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        request_2 = MembershipRequestPrototype.create(
            initiator=account_3,
            account=account_5,
            clan=clan_3,
            text='request',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        self.assertEqual(MembershipRequestPrototype._db_count(), 4)

        self.clan.add_member(account_4)

        self.assertEqual(MembershipRequestPrototype._db_count(), 2)
        self.assertEqual(
            set(r.id for r in MembershipRequestPrototype._db_all()),
            set((request_1.id, request_2.id)))
예제 #6
0
    def test_get_for_account(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(account_2, 0)
        clan_2 = self.create_clan(account_4, 1)
        clan_3 = self.create_clan(account_6, 2)

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

        MembershipRequestPrototype.create(initiator=self.account,
                                          account=self.account,
                                          clan=clan_3,
                                          text=u'invite-2',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

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

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

        self.assertEqual(set(request.id for request in MembershipRequestPrototype.get_for_account(self.account.id)),
                         set([request.id]))
예제 #7
0
    def test_add_member__remove_membership_requests_when_created(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()

        clan_2 = self.create_clan(account_2, 2)
        clan_3 = self.create_clan(account_3, 3)

        MembershipRequestPrototype.create(initiator=account_4,
                                          account=account_4,
                                          clan=clan_2,
                                          text='request',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        MembershipRequestPrototype.create(initiator=account_3,
                                          account=account_4,
                                          clan=clan_3,
                                          text='request',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        request_1 = MembershipRequestPrototype.create(initiator=account_5,
                                                      account=account_5,
                                                      clan=clan_2,
                                                      text='request',
                                                      type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

        request_2 = MembershipRequestPrototype.create(initiator=account_3,
                                                      account=account_5,
                                                      clan=clan_3,
                                                      text='request',
                                                      type=MEMBERSHIP_REQUEST_TYPE.FROM_CLAN)

        self.assertEqual(MembershipRequestPrototype._db_count(), 4)

        self.clan.add_member(account_4)

        self.assertEqual(MembershipRequestPrototype._db_count(), 2)
        self.assertEqual(set(r.id for r in MembershipRequestPrototype._db_all()),
                         set((request_1.id, request_2.id)))
예제 #8
0
    def test_get_for_account(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(account_2, 0)
        clan_2 = self.create_clan(account_4, 1)
        clan_3 = self.create_clan(account_6, 2)

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

        MembershipRequestPrototype.create(
            initiator=self.account,
            account=self.account,
            clan=clan_3,
            text='invite-2',
            type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

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

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

        self.assertEqual(
            set(request.id for request in
                MembershipRequestPrototype.get_for_account(self.account.id)),
            set([request.id]))
예제 #9
0
    def test_get_for_account(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(account_2, 0)
        clan_2 = self.create_clan(account_4, 1)
        clan_3 = self.create_clan(account_6, 2)

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

        MembershipRequestPrototype.create(initiator=self.account,
                                          account=self.account,
                                          clan=clan_3,
                                          text='invite-2',
                                          type=MEMBERSHIP_REQUEST_TYPE.FROM_ACCOUNT)

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

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

        self.assertEqual(set(request.id for request in MembershipRequestPrototype.get_for_account(self.account.id)),
                         set([request.id]))