def test_retrieve_charges(self):
     """Test retrieving the charge."""
     termprint(i, "Test retrieve charges...")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=False)
     self.assertTrue(cl.stripe_object)
     self.assertTrue(cl.stripe_id)
     try:
         charge = cl.retrieve_charge(id='ass')
         assert False, "Nah uh, need a valid integer."
     except Exception as e:
         assert True
     # shouldl get the latest charge by default
     charge1 = cl.retrieve_charge() 
     charge2 = cl.retrieve_charge(id=charge_id)
     # stripe ids should match to charge_id
     self.assertEquals(charge1.get('id'), charge2.get('id'))
     self.assertTrue(cl.stripe_id == charge_id)
     # now test with a different order
     new_charge = cl.create_charge(self.card, captured=False)
     self.assertFalse(cl.stripe_id == charge_id)
     # the current self.stripe_id should be different
     self.assertTrue(cl.stripe_id == new_charge)
     # newest charge1 should be equal to self since its the last one made
     charge1 = cl.retrieve_charge()
     self.assertTrue(charge1, cl.retrieve_charge(id=new_charge))
     self.assertFalse(charge_id == charge1)
     # the ID and OBJECT should be set to self
     self.assertTrue(cl.stripe_id == charge1.get('id'))
     self.assertTrue(cl.stripe_object.get('id') == charge1.get('id'))
示例#2
0
    def test_is_captured(self):
        """Checks if the order was successfully captured.
        You can pass either an ID tring or the charge object itself
        to avoid unneeded lookups."""
        termprint(i, 'Check if order is captured is_captured()')
        cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
        cl.set_price('1.00')
        charge_id = cl.create_charge(self.card, capture=True)
        charge = cl.retrieve_charge(id=charge_id)
        # test by passing ID
        self.assertTrue(cl.is_captured(id=charge_id))
        # test by passing charge object
        self.assertTrue(cl.is_captured(object=charge))
        cl = None

        # try with an uncatured charge
        cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
        cl.set_price('1.00')
        charge_id = cl.create_charge(self.card, capture=False)
        charge = cl.retrieve_charge(id=charge_id)
        self.assertFalse(cl.is_captured(object=charge))
        # test by passing object to avoid another lookup
        result = cl.capture_charge(object=charge)
        # test by passing charge object - remains current before performing refund.
        # you can pass object to just read from the current object assuming all
        # captures were done prior to being set
        self.assertTrue(cl.is_captured(object=charge))
        self.assertTrue(cl.is_captured(id=charge_id))
    def test_is_captured(self):
        """Checks if the order was successfully captured.
        You can pass either an ID tring or the charge object itself
        to avoid unneeded lookups."""
        termprint(i, 'Check if order is captured is_captured()')
        cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
        cl.set_price('1.00')
        charge_id = cl.create_charge(self.card, capture=True)
        charge = cl.retrieve_charge(id=charge_id)
        # test by passing ID
        self.assertTrue(cl.is_captured(id=charge_id))
        # test by passing charge object
        self.assertTrue(cl.is_captured(object=charge))
        cl = None

        # try with an uncatured charge
        cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
        cl.set_price('1.00')
        charge_id = cl.create_charge(self.card, capture=False)
        charge = cl.retrieve_charge(id=charge_id)
        self.assertFalse(cl.is_captured(object=charge))
        # test by passing object to avoid another lookup
        result = cl.capture_charge(object=charge)
        # test by passing charge object - remains current before performing refund.
        # you can pass object to just read from the current object assuming all
        # captures were done prior to being set
        self.assertTrue(cl.is_captured(object=charge))
        self.assertTrue(cl.is_captured(id=charge_id))
 def test_ajax_urls(self):
     """
     Tests ajax url to check on item favorited stats.
     Checks is_favorited, add, remove.
     """
     # first create a sample item to be favorited
     favitem = FavoriteItem(name="Product 1")
     favitem.save()
     ctype = ContentType.objects.get_for_model(type(favitem)).pk
     client = Client()
     client.login(username=self.user.username, password="******")
     response = client.get(reverse("in_favs", kwargs={"content_type": ctype, "object_id": favitem.pk}))
     response_data = simplejson.loads(response.content)
     termprint("WARNING", response.content)
     self.assertFalse(response_data.get("in_favorites"))
     # add in a favorite
     fav = Favorites.objects.add_favorite(self.user, favitem)
     fav_len = len(Favorites.objects.all())
     # check again - should return true
     response = client.get(
         reverse("in_favs", kwargs={"content_type": ctype, "object_id": favitem.pk}),
         {},
         **{"HTTP_X_REQUESTED_WITH": "XMLHttpRequest"}
     )
     response_data = simplejson.loads(response.content)
     termprint("INFO", response.content)
     self.assertTrue(response_data.get("in_favorites"))
示例#5
0
def main(**kwargs):
    #  channel = 'sip/[email protected]', connectTo=('outgoing','s','1') 
    for k in ['channel', 'connect_to', 'user', 'password', 'host']:
        if not kwargs.get(k):
            termprint("ERROR", "Required kwarg %s not present" % k)
            
    f = manager.AMIFactory(kwargs.get('user'), kwargs.get('passwd'))
    df = f.login(kwargs.get('host'))

    def onLogin( protocol ):
        """On Login, attempt to originate the call"""
        context, extension, priority = kwargs.get('connect_to')
        df = protocol.originate(
            kwargs.get('channel'),
            context,extension,priority,
        )
        def onFinished( result ):
            df = protocol.logoff()
            def onLogoff( result ):
                reactor.stop()
            return df.addCallbacks( onLogoff, onLogoff )
        def onFailure( reason ):
            print reason.getTraceback()
            return reason 
        df.addErrback( onFailure )
        df.addCallbacks( onFinished, onFinished )
        return df 

    def onFailure( reason ):
        """Unable to log in!"""
        print reason.getTraceback()
        reactor.stop()

    df.addCallbacks( onLogin, onFailure )
    return df
示例#6
0
 def test_to_cents(self):
     """Test the conversion of the price to cents."""
     termprint(i, "Test conversion of amount$ to pennies.")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     self.assertEquals(cl.to_cents(), 100)
     self.assertEquals(cl.to_cents(), int(Decimal(cl.get_price() * 100)))
示例#7
0
 def test_retrieve_charges(self):
     """Test retrieving the charge."""
     termprint(i, "Test retrieve charges...")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=False)
     self.assertTrue(cl.stripe_object)
     self.assertTrue(cl.stripe_id)
     try:
         charge = cl.retrieve_charge(id='ass')
         assert False, "Nah uh, need a valid integer."
     except Exception as e:
         assert True
     # shouldl get the latest charge by default
     charge1 = cl.retrieve_charge()
     charge2 = cl.retrieve_charge(id=charge_id)
     # stripe ids should match to charge_id
     self.assertEquals(charge1.get('id'), charge2.get('id'))
     self.assertTrue(cl.stripe_id == charge_id)
     # now test with a different order
     new_charge = cl.create_charge(self.card, captured=False)
     self.assertFalse(cl.stripe_id == charge_id)
     # the current self.stripe_id should be different
     self.assertTrue(cl.stripe_id == new_charge)
     # newest charge1 should be equal to self since its the last one made
     charge1 = cl.retrieve_charge()
     self.assertTrue(charge1, cl.retrieve_charge(id=new_charge))
     self.assertFalse(charge_id == charge1)
     # the ID and OBJECT should be set to self
     self.assertTrue(cl.stripe_id == charge1.get('id'))
     self.assertTrue(cl.stripe_object.get('id') == charge1.get('id'))
 def test_to_cents(self):
     """Test the conversion of the price to cents."""
     termprint(i, "Test conversion of amount$ to pennies.")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     self.assertEquals(cl.to_cents(), 100)
     self.assertEquals(cl.to_cents(),
                       int(Decimal(cl.get_price() * 100)))
示例#9
0
    def test_s3shit(self):
        s3 = boto.connect_s3()
        bucket = s3.get_bucket(testbucket)
        self.assertTrue(bucket)

        termprint('INFO', ' %s' % bucket.list())
        bl = bucket.list()
        termprint('ERROR', bl)
        for i in bl:
            print i.name
示例#10
0
 def iter8(self, data, step=0):
     """recursive print"""
     for k, v in data.items():
         spacer = " " * step
         termprint('INFO', '%s%s' % (spacer, k))
         if type(v) is dict:
             self.iter8(v, step=(step+2))
         if type(v) is list:
             for i in v:
                 self.iter8(i, step=(step+4))
示例#11
0
def doauth():
	key, secret = DB_APP_KEY, DB_APP_SECRET
	access_token = ACCESS_TOKEN

	if not ACCESS_TOKEN:
	    # promot input
	    termprint('ERROR', 'You need to generate an access token first.\n')
	    termprint('ERROR', 'Run: ./test-get-access-token.sh')
	    sys.exit()
	return key, secret, access_token
	def __send_message(self, item):
		""" Internal method to send a message """
		connection = establish_connection()
		publisher = Publisher(connection=connection, 
							  exchange="test_messages",
							  routing_key="test_increment_number",
							  exchange_type="direct")
		publisher.send(item)
		termprint("INFO", publisher)
		publisher.close()
		connection.close()
		return publisher
示例#13
0
 def test_model_and_search(self):
     """ Test the model (table) structure. """
     session, metadata, connection = db(*auth)
     cdr_table = map_table(metadata, CDR, cdr, autoload=False, skip_table=True)
     results = db_filter(session, cdr_table, "dst", getattr(s, "TEST_SEARCH_NUMBER", "7861111111"))
     termprint("INFO", cdr_table.__dict__)
     termprint("WARNING", results)
     for i in results:
         termprint("INFO", i.calldate)
         for k, v in i.__dict__.items():
             termprint("ERROR", "\t%s = %s" % (k, v))
         termprint("INFO", "\n-------------------\n\n")
     db_disconnect(connection)
 def test_create_uncaptured_charge(self):
     """ Create an uncaptured charge by passing kwarg."""
     termprint(i, "Test create uncaptured charge.")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=False)
     self.assertEquals(charge_id, cl.stripe_id)
     # test charge retrieval!
     self.assertTrue(cl.retrieve_charge(id=charge_id))
     self.assertTrue(charge_id)
     # charge is not captured!
     self.assertEquals(cl.stripe_object.get('captured'), False)
     cl.capture_charge()
     self.assertEquals(cl.stripe_object.get('captured'), True)
示例#15
0
 def test_create_uncaptured_charge(self):
     """ Create an uncaptured charge by passing kwarg."""
     termprint(i, "Test create uncaptured charge.")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=False)
     self.assertEquals(charge_id, cl.stripe_id)
     # test charge retrieval!
     self.assertTrue(cl.retrieve_charge(id=charge_id))
     self.assertTrue(charge_id)
     # charge is not captured!
     self.assertEquals(cl.stripe_object.get('captured'), False)
     cl.capture_charge()
     self.assertEquals(cl.stripe_object.get('captured'), True)
示例#16
0
 def test_refund(self):
     """ Test refunding an order """
     termprint(i, "Test create refund.")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=True)
     charge = cl.retrieve_charge(id=charge_id)
     self.assertTrue(charge)
     # refunds the most recent
     result = self.assertTrue(cl.refund_charge(id=charge_id))
     termprint(w, result)
     # both charges should be the same, since charge_id
     # is the charge that is in self.stripe_object
     charge = cl.retrieve_charge(id=charge_id)
     self.assertEquals(charge.get('refunded'), True)
    def test_create_job(self):
        """Tests create_job to Transcoder"""
        et = boto.elastictranscoder.connect_to_region('us-east-1')
        #termprint('INFO', dir(ec))
        printobj(et)
        termprint('INFO', et.list_pipelines())
        INPUT_CONFIG['Key'] = 'samplevideo.mp4'
        MP4_OUTPUT['Key'] = 'rendered-%s.mp4' % (randint(111,9999))
        response = et.create_job(
        	TRANSCODER_PIPELINE,
        	INPUT_CONFIG,
        	MP4_OUTPUT,
        )

        termprint('INFO', dict(response))
 def test_refund(self):
     """ Test refunding an order """
     termprint(i, "Test create refund.")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=True)
     charge = cl.retrieve_charge(id=charge_id)
     self.assertTrue(charge)
     # refunds the most recent
     result = self.assertTrue(cl.refund_charge(id=charge_id))
     termprint(w, result)
     # both charges should be the same, since charge_id
     # is the charge that is in self.stripe_object
     charge = cl.retrieve_charge(id=charge_id)
     self.assertEquals(charge.get('refunded'), True)
 def test_is_refunded(self):
     """Checks if an order was successfully refunded.
     You can pass either an ID string or the charge object itself
     to avoid unneeded lookups."""
     termprint(i, "Test is_refunded().")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=True)
     charge = cl.retrieve_charge(id=charge_id)
     self.assertTrue(charge)
     result = self.assertTrue(cl.refund_charge(id=charge_id))
     # test by passing ID - this performs a lookup
     self.assertTrue(cl.is_refunded(id=charge_id))
     # test by passing charge object - remains current before performing refund.
     # you can pass object to just read from the current object assuming all
     # refunds were done prior to being set
     self.assertFalse(cl.is_refunded(object=charge)) 
示例#20
0
 def test_is_refunded(self):
     """Checks if an order was successfully refunded.
     You can pass either an ID string or the charge object itself
     to avoid unneeded lookups."""
     termprint(i, "Test is_refunded().")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=True)
     charge = cl.retrieve_charge(id=charge_id)
     self.assertTrue(charge)
     result = self.assertTrue(cl.refund_charge(id=charge_id))
     # test by passing ID - this performs a lookup
     self.assertTrue(cl.is_refunded(id=charge_id))
     # test by passing charge object - remains current before performing refund.
     # you can pass object to just read from the current object assuming all
     # refunds were done prior to being set
     self.assertFalse(cl.is_refunded(object=charge))
    def test_create_job(self):
        """Tests create_job to Transcoder"""
        if RUN:
            et = boto.elastictranscoder.connect_to_region('us-east-1')
            #termprint('INFO', dir(ec))
            printobj(et)
            termprint('INFO', et.list_pipelines())
            for i in os.listdir('/home/ubuntu/downloaded_03312014/completed'):
                if '.mov' in i:
                    INPUT_CONFIG['Key'] = i
                    MP4_OUTPUT['Key'] = '%s-%s.mp4' % (i, randint(111,9999))
                    response = et.create_job(
                        TRANSCODER_PIPELINE,
                        INPUT_CONFIG,
                        MP4_OUTPUT,
                    )

                    termprint('INFO', dict(response))
示例#22
0
文件: base.py 项目: mikelopez/whtimer
    def create_tables(self, dbfile=None):
        """Create Tables"""
        termprint("INFO", "Creating tables...")
        # remove test.db file from rel directoruy
        if os.path.exists("test.db"):
            os.system('rm test.db')

        # make the tables
        db = Database(connect=True)
        if dbfile:
            db.dbfile = dbfile
        db.maketables()

        # now check they exist
        try:
            db.maketables()
        except Exception, e:
            if "already exists" in str(e):
                pass
            else:
                raise Exception(e)
示例#23
0
    def test_remove_get_favorite(self):
        """
        test adding a favorite for the user on FavoriteItem
        no duplicates for favorites!
        """
        favitem = FavoriteItem(name="Product 1")
        favitem.save()
        self.assertFalse(Favorites.objects.get_favorite(self.user, favitem))

        fav = Favorites.objects.add_favorite(self.user, favitem)
        fav_len = len(Favorites.objects.all())
        self.assertTrue(fav_len == 1)

        # delete it
        fav_del = Favorites.objects.delete_favorite(self.user, favitem)

        fav_len = len(Favorites.objects.all())
        self.assertTrue(fav_len == 0)

        termprint("INFO", my_favorites(self.user))
        self.assertFalse(my_favorites(self.user))
示例#24
0
    def test_add_get_favorite(self):
        """
        test adding a favorite for the user on FavoriteItem
        no duplicates for favorites!
        """
        favitem = FavoriteItem(name="Product 1")
        favitem.save()
        self.assertFalse(Favorites.objects.get_favorite(self.user, favitem))

        fav = Favorites.objects.add_favorite(self.user, favitem)
        fav_len = len(Favorites.objects.all())
        self.assertTrue(fav_len == 1)

        # should not duplicate
        if not Favorites.objects.get_favorite(self.user, favitem):
            termprint("WARNING", "Not found....adding")
            fav_duplicate = Favorites.objects.add_favorite(self.user, favitem)

        fav_len = len(Favorites.objects.all())
        termprint("INFO", "%s rows found " % fav_len)
        self.assertTrue(fav_len == 1)

        favget = Favorites.objects.get_favorite(self.user, favitem)
        self.assertTrue(favget)

        # test the templat tag get
        termprint("INFO", my_favorites(self.user))
        self.assertTrue(my_favorites(self.user))
示例#25
0
def printobj(obj):
	"""Prints the objects instancemethods and """
	for o in dir(obj):
		try:
			termprint(warn, '- %s (%s)' % (o, type(getattr(obj, o))))
		except AttributeError:
			termprint(warn, '- %s ---' % (o))
	termprint(info, 'WE GOOD...')
示例#26
0
 def setUp(self):
     """ Check for project root directory """
     termprint("INFO", 'Checking media directories')
     termprint("WARNING", "\tMEDIA_ROOT = %s" % MEDIA_ROOT)
     #termprint("WARNING", "\tMEDIA_ROOT = %s" % MEDIA_ROOT)
     if not MEDIA_ROOT:
         termprint("ERROR", "Please create the directory: %s" % MEDIA_ROOT)
         assert False, "Media root was not found!"
 def test_s3_file_exists(self):
     """Tests to see if a file exists"""
     s3 = boto.connect_s3()
     bucket = s3.get_bucket(testbucket)
     self.assertTrue(bucket)
     k = bucket.get_key('testvideo.mp4')
     termprint('INFO', k)
     termprint('ERROR', k.__dict__)
     termprint('INFO', 'Found %s' % k.name)
 def test_charge(self):
     """Test the charges."""
     termprint(i, "Testing Charge...")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     self.assertEquals(getattr(cl, "stripe_api_key"), 
                       getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     self.assertEquals(cl.get_price(), Decimal('1.00'))
     charge_id = cl.create_charge(self.card)
     response = cl.capture_charge()
     termprint(e, "Charge ID %s" % charge_id)
     termprint(e, "Charge Capture %s" % response)
示例#29
0
 def test_create_captured_charge(self):
     """ Test creating a test charge. """
     termprint(i, "Test create captured charge...")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=True)
     self.assertEquals(charge_id, cl.stripe_id)
     termprint(e, charge_id)
     termprint(e, cl.stripe_id)
     # test charge retrieval!
     self.assertTrue(cl.retrieve_charge(id=charge_id))
     self.assertEquals(cl.stripe_object.get('captured'), True)
 def test_create_captured_charge(self):
     """ Test creating a test charge. """
     termprint(i, "Test create captured charge...")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     charge_id = cl.create_charge(self.card, capture=True)
     self.assertEquals(charge_id, cl.stripe_id)
     termprint(e, charge_id)
     termprint(e, cl.stripe_id)
     # test charge retrieval!
     self.assertTrue(cl.retrieve_charge(id=charge_id))
     self.assertEquals(cl.stripe_object.get('captured'), True)
示例#31
0
 def test_charge(self):
     """Test the charges."""
     termprint(i, "Testing Charge...")
     cl = StripeCharges(stripe_api_key=getattr(self, "stripe_api_key"))
     self.assertEquals(getattr(cl, "stripe_api_key"),
                       getattr(self, "stripe_api_key"))
     cl.set_price('1.00')
     self.assertEquals(cl.get_price(), Decimal('1.00'))
     charge_id = cl.create_charge(self.card)
     response = cl.capture_charge()
     termprint(e, "Charge ID %s" % charge_id)
     termprint(e, "Charge Capture %s" % response)
示例#32
0
from termprint import *

termprint("INFO", "Cool green text")
termprint("WARNING", "Warning yellow")
termprint("ERROR", "Error red!")
示例#33
0
 def __output_bucket(self, data):
     # output
     termprint('ERROR', 'PRINT BUCKET')
     printobj(data)
示例#34
0
 def test_base_media(self):
     """Finds teh base media path."""
     if not os.path.exists(MEDIA_ROOT):
         termprint("ERROR", "MEDIA ROOT is missing....Create it now!")
         assert False, "Failed to find MEDIA_ROOT"
     assert True, "YAY"
示例#35
0
 def test_galleries_media(self):
     """Finds the galleries subdirectory in media_root"""
     if not os.path.exists("%s/galleries" % (MEDIA_ROOT)):
         termprint("ERROR", "Please create a directory called galleries under MEDIA_ROOT")
         assert False, "Failed to find galleries within MEDIA_ROOT"
     assert True, "YAY"
示例#36
0
 def __output_key(self, data):
     # output
     termprint('ERROR', 'PRINT KEY')
     printobj(data)
 def test_transcoderconnect(self):
     """Tests connection to Transcoder"""
     et = boto.elastictranscoder.connect_to_region('us-east-1')
     #termprint('INFO', dir(ec))
     printobj(et)
     termprint('INFO', et.list_pipelines())
	def test_process_message(self):
		""" Test sending messages. Item will be dogs
		and I will count how many times they each 
		create a lovely stool. Scenario:
		 - Dopey will poop 5 times
		 - Jiggles will poop 7 times
		"""

		termprint("INFO", "Sending messages")
		dopey = [self.__send_message("dopey") for x in range(0,5)]
		jiggles = [self.__send_message("jiggles") for x in range(0,7)]

		connection = establish_connection()
		consumer = Consumer(connection=connection,
							queue="test_messages",
							exchange="test_messages",
							routing_key="test_increment_number",
							exchange_type="direct")
		clicks_for_item = {}
		messages_for_item = {}
		

		# save number of clicks for each 'item'
		termprint("ERROR", consumer)
		termprint("WARNING", dir(consumer))
		messages_count = 0
		for message in consumer.iterqueue():
			data = message.body
			messages_count += 1
			self.assertTrue(data)
			termprint("WARNING", dir(message))
			termprint("WARNING", "\n\tMessage body: %s" % data)
			clicks_for_item[data] = clicks_for_item.get(data, 0) + 1

			# store the message objects too so we can update them after
			if data in messages_for_item.keys():
				messages_for_url[data].append(message)
			else:
				messages_for_url[data] = [message]

			# display the information
			for item, click_count in clicks_for_item.items():
				#termprint("INFO", "\n%s has %s clicks" % item, click_count)
				# acknowledge the message
				[msgs.ack() for msgs in messages_for_item[item]]


		self.assertEquals(messages_count, 12)
		self.assertTrue("dopey" in clicks_for_item.keys())
		self.assertTrue("jiggles" in clicks_for_item.keys())
		self.assertTrue("dopey" in messages_for_item.keys())
		self.assertTrue("jiggles" in messages_for_item.keys())
		self.assertEquals(clicks_for_item.get("dopey"), 5)
		self.assertEquals(clicks_for_item.get("dopey"), 7)

		# queue should now be empty
		messages_queue2 = consumer.iterqueue()
		messages2_count = 0
		[messages2_count + 1 for i in messages_queue2]
		self.assertTrue(len(messages2_count) == 0)

		consumer.close()
		connection.close()