Exemple #1
0
    def test_duplicate_name(self):
        # Create a mock store
        store = MockMarketPlaceGlobalStore()

        # Because we have not "registered" any participants, the name
        # should not be a duplicate
        update = participant_update.UpdateName(
            minfo={
                'ObjectID': '0000000000000000',
                'CreatorID': '0000000000000000',
                'Name': 'participant'
            })
        self.assertTrue(update.is_valid_name(store))

        # Put a participant in the store
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000', minfo={
                'name': 'participant',
            })
        store = MockMarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()
        store.bind(store.i2n(participant.ObjectID), participant.ObjectID)

        # Because the participant name is in the store, trying to update the
        # name a valid name as it is a duplicate
        update = participant_update.UpdateName(
            minfo={
                'ObjectID': participant.ObjectID,
                'CreatorID': participant.ObjectID,
                'Name': 'participant'
            })
        self.assertFalse(update.is_valid_name(store))
    def test_duplicate_name(self):
        # Create a mock store and put a participant in it
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000',
            minfo={
                'name': 'participant',
            })
        store = MarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()

        # Because we have not "registered" any asset types, the name
        # should not be a duplicate
        update = asset_type_update.Register(
            update_type=asset_type_update.Register.UpdateType,
            creator_id=participant.ObjectID,
            name='/assettype'
        )
        self.assertTrue(market_place_object_update.global_is_valid_name(
            store,
            name='/assettype',
            object_type=update.ObjectType,
            creator_id=participant.ObjectID))

        # Add an asset type to the store with the creator being the
        # participant we inserted initially
        asset_type = asset_type_update.AssetTypeObject(
            objectid='0000000000000001',
            minfo={
                'name': '//participant/assettype',
                'creator': participant.ObjectID
            })
        store[asset_type.ObjectID] = asset_type.dump()

        # Because the asset type name is in the store, trying to register
        # using a relative name based upon creator and a fully-qualified name
        # should not be a valid name as it is a duplicate
        asset_type = asset_type_update.Register(
            update_type=asset_type_update.Register.UpdateType,
            creator_id=participant.ObjectID,
            name='/assettype'
        )
        self.assertFalse(market_place_object_update.global_is_valid_name(
            store,
            name='/assettype',
            object_type=asset_type.ObjectType,
            creator_id=participant.ObjectID))

        update = asset_type_update.Register(
            update_type=asset_type_update.Register.UpdateType,
            creator_id=participant.ObjectID,
            name='//participant/assettype'
        )
        self.assertFalse(market_place_object_update.global_is_valid_name(
            store,
            name='//participant/assettype',
            object_type=update.ObjectType,
            creator_id=participant.ObjectID))
Exemple #3
0
    def test_duplicate_name(self):
        # Create a mock store and put a participant in it
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000', minfo={
                'name': 'participant',
            })
        store = MarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()

        # Because we have not "registered" any sell offers, the name
        # should not be a duplicate
        update = sell_offer_update.Register(
            input_id='**FAKE**',
            output_id='**FAKE**',
            update_type=sell_offer_update.Register.UpdateType,
            creator_id=participant.ObjectID,
            name='/selloffer')
        self.assertTrue(
            market_place_object_update.global_is_valid_name(
                store, '/selloffer', sell_offer_update.Register.ObjectType,
                participant.ObjectID))

        # Add a sell offer to the store with the creator being the participant
        # we inserted initially
        sell_offer = sell_offer_update.SellOfferObject(
            objectid='0000000000000001',
            minfo={
                'name': '//participant/selloffer',
                'creator': participant.ObjectID
            })
        store[sell_offer.ObjectID] = sell_offer.dump()

        # Because the sell offer name is in the store, trying to register
        # using a relative name based upon creator and a fully-qualified name
        # should not be a valid name as it is a duplicate
        update = sell_offer_update.Register(
            input_id='**FAKE**',
            output_id='**FAKE**',
            update_type=sell_offer_update.Register,
            creator_id=participant.ObjectID,
            name='/selloffer')
        self.assertFalse(
            market_place_object_update.global_is_valid_name(
                store, '/selloffer', sell_offer_update.Register.ObjectType,
                participant.ObjectID))
        update = sell_offer_update.Register(
            update_type=sell_offer_update.Register.UpdateType,
            input_id='**FAKE**',
            output_id='**FAKE**',
            creator_id=participant.ObjectID,
            name='//participant/selloffer')
        self.assertFalse(
            market_place_object_update.global_is_valid_name(
                store, '//participant/selloffer',
                sell_offer_update.Register.ObjectType, participant.ObjectID))
Exemple #4
0
    def test_duplicate_name(self):
        # Create a mock store and put a participant in it
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000',
            minfo={
                'name': 'participant',
            })
        store = MarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()

        # Because we have not "registered" any liabilities, the name
        # should not be a duplicate
        update = liability_update.Register(
            update_type=liability_update.Register.UpdateType,
            creator_id=participant.ObjectID,
            name='/liability'
        )
        self.assertTrue(global_is_valid_name(
            store, '/liability',
            liability_update.Register.ObjectType,
            participant.ObjectID))

        # Add a liability to the store with the creator being the participant
        # we inserted initially
        liability = liability_update.LiabilityObject(
            objectid='0000000000000001',
            minfo={
                'name': '//participant/liability',
                'creator': participant.ObjectID
            })
        store[liability.ObjectID] = liability.dump()

        # Because the liability name is in the store, trying to register using
        # a relative name based upon creator and a fully-qualified name should
        # not be a valid name as it is a duplicate
        update = liability_update.Register(
            update_type=liability_update.Register.UpdateType,
            creator_id=participant.ObjectID,
            name='/liability'
        )
        self.assertFalse(global_is_valid_name(
            store, '/liability',
            liability_update.Register.ObjectType,
            participant.ObjectID))

        update = liability_update.Register(
            update_type=liability_update.Register.UpdateType,
            creator_id=participant.ObjectID,
            name='//participant/liability'
        )
        self.assertFalse(global_is_valid_name(
            store, '//participant/liability',
            liability_update.Register.ObjectType,
            participant.ObjectID))
Exemple #5
0
    def test_duplicate_name(self):
        # Create a mock store and put a participant in it
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000',
            minfo={
                'name': 'participant',
            })
        store = MockMarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()
        store.bind(store.i2n(participant.ObjectID), participant.ObjectID)

        # Because we have not "registered" any holdings, the name
        # should not be a duplicate
        update = holding_update.UpdateName(
            minfo={
                'ObjectID': '0000000000000001',
                'CreatorID': participant.ObjectID,
                'Name': '/holding'
            })
        self.assertTrue(update.is_valid_name(store))

        # Add a holding to the store with the creator being the participant
        # we inserted initially
        holding = holding_update.HoldingObject(
            objectid='0000000000000001',
            minfo={
                'name': '//participant/holding',
                'creator': participant.ObjectID
            })
        store[holding.ObjectID] = holding.dump()
        store.bind(store.i2n(holding.ObjectID), holding.ObjectID)

        # Because the holding name is in the store, trying to update the name
        # using a relative name based upon creator and a fully-qualified name
        # should not be a valid name as it is a duplicate
        update = holding_update.UpdateName(
            minfo={
                'ObjectID': holding.ObjectID,
                'CreatorID': participant.ObjectID,
                'Name': '/holding'
            })
        self.assertFalse(update.is_valid_name(store))
        update = holding_update.UpdateName(
            minfo={
                'ObjectID': holding.ObjectID,
                'CreatorID': participant.ObjectID,
                'Name': '//participant/holding'
            })
        self.assertFalse(update.is_valid_name(store))
Exemple #6
0
    def test_duplicate_name(self):
        # Create a mock store and put a participant in it
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000', minfo={
                'name': 'participant',
            })
        store = MockMarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()
        store.bind(store.i2n(participant.ObjectID), participant.ObjectID)

        # Because we have not "registered" any exchange offers, the name
        # should not be a duplicate
        update = exchange_offer_update.UpdateName(
            minfo={
                'ObjectID': '0000000000000001',
                'CreatorID': participant.ObjectID,
                'Name': '/exchangeoffer'
            })
        self.assertTrue(update.is_valid_name(store))

        # Add an exchange offer to the store with the creator being the
        # participant we inserted initially
        exchange_offer = exchange_offer_update.ExchangeOfferObject(
            objectid='0000000000000001',
            minfo={
                'name': '//participant/exchangeoffer',
                'creator': participant.ObjectID
            })
        store[exchange_offer.ObjectID] = exchange_offer.dump()
        store.bind(store.i2n(exchange_offer.ObjectID), exchange_offer.ObjectID)

        # Because the exchange offer name is in the store, trying to update
        # the name using a relative name based upon creator and a fully-
        # qualified name should not be a valid name as it is a duplicate
        update = exchange_offer_update.UpdateName(
            minfo={
                'ObjectID': exchange_offer.ObjectID,
                'CreatorID': participant.ObjectID,
                'Name': '/exchangeoffer'
            })
        self.assertFalse(update.is_valid_name(store))
        update = exchange_offer_update.UpdateName(
            minfo={
                'ObjectID': exchange_offer.ObjectID,
                'CreatorID': participant.ObjectID,
                'Name': '//participant/exchangeoffer'
            })
        self.assertFalse(update.is_valid_name(store))
Exemple #7
0
    def test_duplicate_name(self):
        # Create a mock store and put a participant in it
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000', minfo={
                'name': 'participant',
            })
        store = MockMarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()
        store.bind(store.i2n(participant.ObjectID), participant.ObjectID)

        # Because we have not "registered" any asset types, the name
        # should not be a duplicate
        update = asset_type_update.UpdateName(
            minfo={
                'ObjectID': '0000000000000001',
                'CreatorID': participant.ObjectID,
                'Name': '/assettype'
            })
        self.assertTrue(update.is_valid_name(store))

        # Add an asset type to the store with the creator being the
        # participant we inserted initially
        asset_type = asset_type_update.AssetTypeObject(
            objectid='0000000000000001',
            minfo={
                'name': '//participant/assettype',
                'creator': participant.ObjectID
            })
        store[asset_type.ObjectID] = asset_type.dump()
        store.bind(store.i2n(asset_type.ObjectID), asset_type.ObjectID)

        # Because the assett type name is in the store, trying to update the
        # name using a relative name based upon creator and a fully-qualified
        # name should not be a valid name as it is a duplicate
        update = asset_type_update.UpdateName(
            minfo={
                'ObjectID': asset_type.ObjectID,
                'CreatorID': participant.ObjectID,
                'Name': '/assettype'
            })
        self.assertFalse(update.is_valid_name(store))
        update = asset_type_update.UpdateName(
            minfo={
                'ObjectID': asset_type.ObjectID,
                'CreatorID': participant.ObjectID,
                'Name': '//participant/assettype'
            })
        self.assertFalse(update.is_valid_name(store))
    def test_duplicate_name(self):
        # Create a mock store and put a participant in it
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000',
            minfo={
                'name': 'participant',
            })
        store = MockMarketPlaceGlobalStore()
        store[participant.ObjectID] = participant.dump()
        store.bind(store.i2n(participant.ObjectID), participant.ObjectID)

        # Because we have not "registered" any accounts, the name
        # should not be a duplicate
        update = account_update.Register(
            minfo={
                'CreatorID': participant.ObjectID,
                'Name': '/account'
            })
        self.assertTrue(update.is_valid_name(store))

        # Add an account to the store with the creator being the participant
        # we inserted initially
        account = account_update.AccountObject(
            objectid='0000000000000001',
            minfo={
                'name': '//participant/account',
                'creator': participant.ObjectID
            })
        store[account.ObjectID] = account.dump()
        store.bind(store.i2n(account.ObjectID), account.ObjectID)

        # Because the account name is in the store, trying to register using
        # a relative name based upon creator and a fully-qualified name should
        # not be a valid name as it is a duplicate
        update = account_update.Register(
            minfo={
                'CreatorID': participant.ObjectID,
                'Name': '/account'
            })
        self.assertFalse(update.is_valid_name(store))
        update = account_update.Register(
            minfo={
                'CreatorID': participant.ObjectID,
                'Name': '//participant/account'
            })
        self.assertFalse(update.is_valid_name(store))
    def test_duplicate_name(self):
        # Create a mock store
        store = MarketPlaceGlobalStore()

        # Because we have not "registered" any participants, the name
        # should not be a duplicate
        update = participant_update.Register(
            update_type=participant_update.Register.UpdateType,
            name='participant')
        self.assertTrue(update.is_valid_name(store))

        #  Put a participant in the store
        participant = participant_update.ParticipantObject(
            participantid='0000000000000000', minfo={
                'name': 'participant',
            })
        store[participant.ObjectID] = participant.dump()

        # Because the participant name is in the store, the name should
        # not be a valid name as it is a duplicate
        update = participant_update.Register(
            update_type=participant_update.Register.UpdateType,
            name='participant')
        self.assertFalse(update.is_valid_name(store))