Esempio n. 1
0
	def testPlayerControlClass(self):
		pc = PlayerControl()
		pc.addQueueItem(5)
		self.assertEqual(pc.getQueue(), [5])
		
		# Test queue item removal in an unallowed range
		self.assertFalse(pc.removeQueueItem(2) , "You cannot delete an item at index 2 if there is only 1 item in the queue" )
		pc.addQueueItem(6)
		
		# Test queue item removal on a valid index
		self.assertTrue(pc.removeQueueItem(1) , "You should be able to delete a queue item by a valid index" )
		
		# Create an empty queue
		pc.flushQueue()
		self.assertEqual(pc.getQueue(), [], "Queue should be empty after flushQueue")
		
		pc.addQueueItem(1)
		pc.addQueueItem(2)
		pc.addQueueItem(3)
		
		# Set the current queue entry pointer to a valid value. True must be returned.
		self.assertTrue(pc.setCurrentQueueEntry(1))

		# Set the current queue entry pointer to an invalid value. False must be returned.
		self.assertFalse(pc.setCurrentQueueEntry(3))
Esempio n. 2
0
    def testPlayerControlClass(self):
        pc = PlayerControl()
        pc.addQueueItem(5)
        self.assertEqual(pc.getQueue(), [5])

        # Test queue item removal in an unallowed range
        self.assertFalse(
            pc.removeQueueItem(2),
            "You cannot delete an item at index 2 if there is only 1 item in the queue"
        )
        pc.addQueueItem(6)

        # Test queue item removal on a valid index
        self.assertTrue(
            pc.removeQueueItem(1),
            "You should be able to delete a queue item by a valid index")

        # Create an empty queue
        pc.flushQueue()
        self.assertEqual(pc.getQueue(), [],
                         "Queue should be empty after flushQueue")

        pc.addQueueItem(1)
        pc.addQueueItem(2)
        pc.addQueueItem(3)

        # Set the current queue entry pointer to a valid value. True must be returned.
        self.assertTrue(pc.setCurrentQueueEntry(1))

        # Set the current queue entry pointer to an invalid value. False must be returned.
        self.assertFalse(pc.setCurrentQueueEntry(3))
Esempio n. 3
0
	def testAddingDirectories(self):
		pc = PlayerControl()
		queueFrameProcessor = QueueFrameProcessor(pc)
		
		# Test a non-existing directory
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'file', 'path': "./noneExistingDir/"}))

		response = queueFrameProcessor.process(mf)
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_ADD, muzykaProtocol.FILE_NOT_FOUND ).toString(),
											"QUEUE_ADD with invalid filepath doesnt respond with FILE_NOT_FOUND")
		# Add an existing directory
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'file', 'path': "./testAudioFiles/"}))
    
		response = queueFrameProcessor.process(mf)
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_ADD, muzykaProtocol.SERVER_ACK + str(0) ).toString(),
											"QUEUE_ADD with a valid directory doesnt respond with SERVER_ACK")
		
		# Check the entries of the list
		self.assertEqual( pc.getQueue()[0].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./testAudioFiles/audio1.mp3").toString() ,"The list is in an unexcepted state")
		self.assertEqual( pc.getQueue()[1].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./testAudioFiles/audio2.mp3").toString() ,"The list is in an unexcepted state")
		
		# There should only be 2 audio files in the queue. 
		self.assertEqual( len (pc.getQueue()), 2)
		
		pc.flushQueue()
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'file', 'path': "./dummyMP3Test.mp3"}))
		queueFrameProcessor.process(mf)
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'file', 'path': "./dummyMP3Test2.mp3"}))
		queueFrameProcessor.process(mf)

		# There should be 2 audio files in the queue now. 
		self.assertEqual( len (pc.getQueue()), 2)							

			
		# Use INSERT_AT to add the contents of the directory testAudioFiles
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
											yaml.dump({'type': 'file', 'path': "./testAudioFiles", 'idx': 1}))
											
		response = queueFrameProcessor.process(mf)
		# muzykaFrame.debugString(response.toString())
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_INSERT_AT, muzykaProtocol.SERVER_ACK + str(1) ).toString(),
											"QUEUE_ADD with a valid directory doesnt respond with SERVER_ACK")											
		
		# There should be 4 audio files in the queue now. 
		self.assertEqual( len (pc.getQueue()), 4)							
		
		# Check the entries of the list
		self.assertEqual( pc.getQueue()[0].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./dummyMP3Test.mp3").toString() ,"The list is in an unexcepted state")
		self.assertEqual( pc.getQueue()[1].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./testAudioFiles/audio1.mp3").toString() ,"The list is in an unexcepted state")
		self.assertEqual( pc.getQueue()[2].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./testAudioFiles/audio2.mp3").toString() ,"The list is in an unexcepted state")
		self.assertEqual( pc.getQueue()[3].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./dummyMP3Test2.mp3").toString() ,"The list is in an unexcepted state")
Esempio n. 4
0
	def testQueueFrames(self):
		playerControl = PlayerControl()
		queueFrameProcessor = QueueFrameProcessor(playerControl)
		
		# Create QUEUE_ADD frame and process it
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'song', 'song_id': 5}))
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_ADD, muzykaProtocol.SERVER_ACK + str(0) ).toString(),
											"The QueueFrameProcessor response for QUEUE_ADD is invalid. The response should be SERVER_ACK with id 0")
											
		# print playerControl.getQueue()[0].toString()
		self.assertEqual( playerControl.getQueue()[0].toString() , QueueEntry( QueueEntry.TYPE_SONG, 5).toString() ,"The list is in an unexcepted state")
		
		# Create QUEUE_ADD frame and process it
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'song', 'song_id': 30000}))
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_ADD, muzykaProtocol.SERVER_ACK + str(1) ).toString(),
											"The QueueFrameProcessor response for QUEUE_ADD with a song is invalid. The response should be SERVER_ACK with id 1")
											
		# self.assertEqual( playerControl.getQueue() , [5,30000],"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[0].toString() , QueueEntry( QueueEntry.TYPE_SONG, 5).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[1].toString() , QueueEntry( QueueEntry.TYPE_SONG, 30000).toString() ,"The list is in an unexcepted state")
		
		
		# Create QUEUE_ADD frame and process it
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'song', 'song_id': 3000000000}))
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_ADD, muzykaProtocol.SERVER_ACK + str(2) ).toString(),
											"The QueueFrameProcessor response for QUEUE_ADD with a song is invalid. The response should be SERVER_ACK with id 2")
											
		# self.assertEqual( playerControl.getQueue() , [5,30000,3000000000],"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[0].toString() , QueueEntry( QueueEntry.TYPE_SONG, 5).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[1].toString() , QueueEntry( QueueEntry.TYPE_SONG, 30000).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[2].toString() , QueueEntry( QueueEntry.TYPE_SONG, 3000000000).toString() ,"The list is in an unexcepted state")
		
		# Test the removal of queue items.
		# Begin with a removal request which is out of bounds.
		
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_REMOVE, 3)
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_REMOVE, muzykaProtocol.QUEUE_ENTRY_NOT_FOUND ).toString(),
											"The QueueFrameProcessor response for QUEUE_REMOVE is invalid. The response should \
											 be QUEUE_ENTRY_NOT_FOUND because the requested index is too damn high")
											
		# The queue shouldnt been altered.
		# self.assertEqual( playerControl.getQueue() , [5,30000,3000000000],"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[0].toString() , QueueEntry( QueueEntry.TYPE_SONG, 5).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[1].toString() , QueueEntry( QueueEntry.TYPE_SONG, 30000).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[2].toString() , QueueEntry( QueueEntry.TYPE_SONG, 3000000000).toString() ,"The list is in an unexcepted state")
		
		# Perform a valid remove request
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_REMOVE, 1)
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_REMOVE, muzykaProtocol.SERVER_ACK ).toString(),
											"The QueueFrameProcessor response for QUEUE_REMOVE is invalid. The response should \
											 be SERVER_ACK and the list should be queue.PRE.size()-1")
											
		# The item in the  middle should have been removed.
		# self.assertEqual( playerControl.getQueue() , [5,3000000000],"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[0].toString() , QueueEntry( QueueEntry.TYPE_SONG, 5).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[1].toString() , QueueEntry( QueueEntry.TYPE_SONG, 3000000000).toString() ,"The list is in an unexcepted state")
		
		# Perform a QUEUE_LIST request
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_LIST, "")
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(),
		 									muzykaFrame( muzykaProtocol.QUEUE,
		 																muzykaProtocol.QUEUE_LIST,
		 																yaml.dump( [QueueEntry( QueueEntry.TYPE_SONG, 5),
																								QueueEntry( QueueEntry.TYPE_SONG, 3000000000)] ) 
																	).toString(),
											"The QueueFrameProcessor response for QUEUE_LIST is invalid. The response should \
											 be a YAML serialized queue list")
											
		# # The item in the  middle should have been removed.
		# self.assertEqual( playerControl.getQueue() , [5,3000000000],"The list is in an unexcepted state")
		
		# Perform a QUEUE_INSERT_SONG_AT request
		# mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_SONG_AT, pack('ii',1,23) )
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
											yaml.dump({'type': 'song', 'song_id': 23, 'idx': 1}))

		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_INSERT_AT, muzykaProtocol.SERVER_ACK + str(1) ).toString(),
											"The QueueFrameProcessor response for QUEUE_INSERT_AT is invalid. The response should \
											 be SERVER_ACK + '1'")
											
		# The item 23 should now be in the middle of the queue.
		# self.assertEqual( playerControl.getQueue() , [5,23,3000000000],"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[0].toString() ,
		 									QueueEntry( QueueEntry.TYPE_SONG, 5).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[1].toString() ,
		 									QueueEntry( QueueEntry.TYPE_SONG, 23).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[2].toString() ,
		 									QueueEntry( QueueEntry.TYPE_SONG, 3000000000).toString() ,"The list is in an unexcepted state")
		
		
		# Perform a QUEUE_INSERT_SONG_AT request out of bounds
		# mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_SONG_AT, pack('ii',500,42) )
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
											yaml.dump({'type': 'song', 'song_id': 42, 'idx': 500}))
		
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_INSERT_AT, muzykaProtocol.SERVER_ACK + str(3) ).toString(),
											"The QueueFrameProcessor response for QUEUE_INSERT_AT is invalid. The response should \
											 be SERVER_ACK + '3'")
											
		# The item 42 should be at the end of the queue.
		# self.assertEqual( playerControl.getQueue() , [5,23,3000000000,42],"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[0].toString() ,
		 									QueueEntry( QueueEntry.TYPE_SONG, 5).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[1].toString() ,
		 									QueueEntry( QueueEntry.TYPE_SONG, 23).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[2].toString() ,
		 									QueueEntry( QueueEntry.TYPE_SONG, 3000000000).toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[3].toString() ,
		 									QueueEntry( QueueEntry.TYPE_SONG, 42).toString() ,"The list is in an unexcepted state")
		
		playerControl.flushQueue()
		
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
											yaml.dump({'type': 'file', 'path': "./dummyMP3Test.mp3"}))
		
		response = queueFrameProcessor.process(mf)
		
		self.assertEqual( playerControl.getQueue()[0].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./dummyMP3Test.mp3").toString() ,"The list is in an unexcepted state")

		# mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_FILE_AT, pack('is', 0 ,) )
		mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
											yaml.dump({'type': 'file', 'path': "./dummyMP3Test2.mp3", 'idx': 0}))

		response = queueFrameProcessor.process(mf)
		self.assertEqual(response.toString(), muzykaFrame( muzykaProtocol.QUEUE,
		 									muzykaProtocol.QUEUE_INSERT_AT, muzykaProtocol.SERVER_ACK + str(0) ).toString(),
											"QUEUE_INSERT_AT with valid filepath doesnt respond with SERVER_ACK")		
		
		
		self.assertEqual( playerControl.getQueue()[0].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./dummyMP3Test2.mp3").toString() ,"The list is in an unexcepted state")
		self.assertEqual( playerControl.getQueue()[1].toString() ,
		 									QueueEntry( QueueEntry.TYPE_FILE, "./dummyMP3Test.mp3").toString() ,"The list is in an unexcepted state")
Esempio n. 5
0
    def testAddingDirectories(self):
        pc = PlayerControl()
        queueFrameProcessor = QueueFrameProcessor(pc)

        # Test a non-existing directory
        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
            yaml.dump({
                'type': 'file',
                'path': "./noneExistingDir/"
            }))

        response = queueFrameProcessor.process(mf)
        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                        muzykaProtocol.FILE_NOT_FOUND).toString(),
            "QUEUE_ADD with invalid filepath doesnt respond with FILE_NOT_FOUND"
        )
        # Add an existing directory
        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
            yaml.dump({
                'type': 'file',
                'path': "./testAudioFiles/"
            }))

        response = queueFrameProcessor.process(mf)
        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                        muzykaProtocol.SERVER_ACK + str(0)).toString(),
            "QUEUE_ADD with a valid directory doesnt respond with SERVER_ACK")

        # Check the entries of the list
        self.assertEqual(
            pc.getQueue()[0].toString(),
            QueueEntry(QueueEntry.TYPE_FILE,
                       "./testAudioFiles/audio1.mp3").toString(),
            "The list is in an unexcepted state")
        self.assertEqual(
            pc.getQueue()[1].toString(),
            QueueEntry(QueueEntry.TYPE_FILE,
                       "./testAudioFiles/audio2.mp3").toString(),
            "The list is in an unexcepted state")

        # There should only be 2 audio files in the queue.
        self.assertEqual(len(pc.getQueue()), 2)

        pc.flushQueue()
        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
            yaml.dump({
                'type': 'file',
                'path': "./dummyMP3Test.mp3"
            }))
        queueFrameProcessor.process(mf)
        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
            yaml.dump({
                'type': 'file',
                'path': "./dummyMP3Test2.mp3"
            }))
        queueFrameProcessor.process(mf)

        # There should be 2 audio files in the queue now.
        self.assertEqual(len(pc.getQueue()), 2)

        # Use INSERT_AT to add the contents of the directory testAudioFiles
        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
            yaml.dump({
                'type': 'file',
                'path': "./testAudioFiles",
                'idx': 1
            }))

        response = queueFrameProcessor.process(mf)
        # muzykaFrame.debugString(response.toString())
        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
                        muzykaProtocol.SERVER_ACK + str(1)).toString(),
            "QUEUE_ADD with a valid directory doesnt respond with SERVER_ACK")

        # There should be 4 audio files in the queue now.
        self.assertEqual(len(pc.getQueue()), 4)

        # Check the entries of the list
        self.assertEqual(
            pc.getQueue()[0].toString(),
            QueueEntry(QueueEntry.TYPE_FILE, "./dummyMP3Test.mp3").toString(),
            "The list is in an unexcepted state")
        self.assertEqual(
            pc.getQueue()[1].toString(),
            QueueEntry(QueueEntry.TYPE_FILE,
                       "./testAudioFiles/audio1.mp3").toString(),
            "The list is in an unexcepted state")
        self.assertEqual(
            pc.getQueue()[2].toString(),
            QueueEntry(QueueEntry.TYPE_FILE,
                       "./testAudioFiles/audio2.mp3").toString(),
            "The list is in an unexcepted state")
        self.assertEqual(
            pc.getQueue()[3].toString(),
            QueueEntry(QueueEntry.TYPE_FILE, "./dummyMP3Test2.mp3").toString(),
            "The list is in an unexcepted state")
Esempio n. 6
0
    def testQueueFrames(self):
        playerControl = PlayerControl()
        queueFrameProcessor = QueueFrameProcessor(playerControl)

        # Create QUEUE_ADD frame and process it
        mf = muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                         yaml.dump({
                             'type': 'song',
                             'song_id': 5
                         }))
        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                        muzykaProtocol.SERVER_ACK + str(0)).toString(),
            "The QueueFrameProcessor response for QUEUE_ADD is invalid. The response should be SERVER_ACK with id 0"
        )

        # print playerControl.getQueue()[0].toString()
        self.assertEqual(playerControl.getQueue()[0].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 5).toString(),
                         "The list is in an unexcepted state")

        # Create QUEUE_ADD frame and process it
        mf = muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                         yaml.dump({
                             'type': 'song',
                             'song_id': 30000
                         }))
        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                        muzykaProtocol.SERVER_ACK + str(1)).toString(),
            "The QueueFrameProcessor response for QUEUE_ADD with a song is invalid. The response should be SERVER_ACK with id 1"
        )

        # self.assertEqual( playerControl.getQueue() , [5,30000],"The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[0].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 5).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[1].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 30000).toString(),
                         "The list is in an unexcepted state")

        # Create QUEUE_ADD frame and process it
        mf = muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                         yaml.dump({
                             'type': 'song',
                             'song_id': 3000000000
                         }))
        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
                        muzykaProtocol.SERVER_ACK + str(2)).toString(),
            "The QueueFrameProcessor response for QUEUE_ADD with a song is invalid. The response should be SERVER_ACK with id 2"
        )

        # self.assertEqual( playerControl.getQueue() , [5,30000,3000000000],"The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[0].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 5).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[1].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 30000).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(
            playerControl.getQueue()[2].toString(),
            QueueEntry(QueueEntry.TYPE_SONG, 3000000000).toString(),
            "The list is in an unexcepted state")

        # Test the removal of queue items.
        # Begin with a removal request which is out of bounds.

        mf = muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_REMOVE, 3)
        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_REMOVE,
                        muzykaProtocol.QUEUE_ENTRY_NOT_FOUND).toString(),
            "The QueueFrameProcessor response for QUEUE_REMOVE is invalid. The response should \
											 be QUEUE_ENTRY_NOT_FOUND because the requested index is too damn high"
        )

        # The queue shouldnt been altered.
        # self.assertEqual( playerControl.getQueue() , [5,30000,3000000000],"The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[0].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 5).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[1].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 30000).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(
            playerControl.getQueue()[2].toString(),
            QueueEntry(QueueEntry.TYPE_SONG, 3000000000).toString(),
            "The list is in an unexcepted state")

        # Perform a valid remove request
        mf = muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_REMOVE, 1)
        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_REMOVE,
                        muzykaProtocol.SERVER_ACK).toString(),
            "The QueueFrameProcessor response for QUEUE_REMOVE is invalid. The response should \
											 be SERVER_ACK and the list should be queue.PRE.size()-1")

        # The item in the  middle should have been removed.
        # self.assertEqual( playerControl.getQueue() , [5,3000000000],"The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[0].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 5).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(
            playerControl.getQueue()[1].toString(),
            QueueEntry(QueueEntry.TYPE_SONG, 3000000000).toString(),
            "The list is in an unexcepted state")

        # Perform a QUEUE_LIST request
        mf = muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_LIST, "")
        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(
                muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_LIST,
                yaml.dump([
                    QueueEntry(QueueEntry.TYPE_SONG, 5),
                    QueueEntry(QueueEntry.TYPE_SONG, 3000000000)
                ])).toString(),
            "The QueueFrameProcessor response for QUEUE_LIST is invalid. The response should \
											 be a YAML serialized queue list")

        # # The item in the  middle should have been removed.
        # self.assertEqual( playerControl.getQueue() , [5,3000000000],"The list is in an unexcepted state")

        # Perform a QUEUE_INSERT_SONG_AT request
        # mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_SONG_AT, pack('ii',1,23) )
        mf = muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
                         yaml.dump({
                             'type': 'song',
                             'song_id': 23,
                             'idx': 1
                         }))

        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
                        muzykaProtocol.SERVER_ACK + str(1)).toString(),
            "The QueueFrameProcessor response for QUEUE_INSERT_AT is invalid. The response should \
											 be SERVER_ACK + '1'")

        # The item 23 should now be in the middle of the queue.
        # self.assertEqual( playerControl.getQueue() , [5,23,3000000000],"The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[0].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 5).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[1].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 23).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(
            playerControl.getQueue()[2].toString(),
            QueueEntry(QueueEntry.TYPE_SONG, 3000000000).toString(),
            "The list is in an unexcepted state")

        # Perform a QUEUE_INSERT_SONG_AT request out of bounds
        # mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_SONG_AT, pack('ii',500,42) )
        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
            yaml.dump({
                'type': 'song',
                'song_id': 42,
                'idx': 500
            }))

        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
                        muzykaProtocol.SERVER_ACK + str(3)).toString(),
            "The QueueFrameProcessor response for QUEUE_INSERT_AT is invalid. The response should \
											 be SERVER_ACK + '3'")

        # The item 42 should be at the end of the queue.
        # self.assertEqual( playerControl.getQueue() , [5,23,3000000000,42],"The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[0].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 5).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[1].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 23).toString(),
                         "The list is in an unexcepted state")
        self.assertEqual(
            playerControl.getQueue()[2].toString(),
            QueueEntry(QueueEntry.TYPE_SONG, 3000000000).toString(),
            "The list is in an unexcepted state")
        self.assertEqual(playerControl.getQueue()[3].toString(),
                         QueueEntry(QueueEntry.TYPE_SONG, 42).toString(),
                         "The list is in an unexcepted state")

        playerControl.flushQueue()

        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_ADD,
            yaml.dump({
                'type': 'file',
                'path': "./dummyMP3Test.mp3"
            }))

        response = queueFrameProcessor.process(mf)

        self.assertEqual(
            playerControl.getQueue()[0].toString(),
            QueueEntry(QueueEntry.TYPE_FILE, "./dummyMP3Test.mp3").toString(),
            "The list is in an unexcepted state")

        # mf = muzykaFrame( muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_FILE_AT, pack('is', 0 ,) )
        mf = muzykaFrame(
            muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
            yaml.dump({
                'type': 'file',
                'path': "./dummyMP3Test2.mp3",
                'idx': 0
            }))

        response = queueFrameProcessor.process(mf)
        self.assertEqual(
            response.toString(),
            muzykaFrame(muzykaProtocol.QUEUE, muzykaProtocol.QUEUE_INSERT_AT,
                        muzykaProtocol.SERVER_ACK + str(0)).toString(),
            "QUEUE_INSERT_AT with valid filepath doesnt respond with SERVER_ACK"
        )

        self.assertEqual(
            playerControl.getQueue()[0].toString(),
            QueueEntry(QueueEntry.TYPE_FILE, "./dummyMP3Test2.mp3").toString(),
            "The list is in an unexcepted state")
        self.assertEqual(
            playerControl.getQueue()[1].toString(),
            QueueEntry(QueueEntry.TYPE_FILE, "./dummyMP3Test.mp3").toString(),
            "The list is in an unexcepted state")