示例#1
0
class TestModule(unittest.TestCase):
	def setUp(self):
		self.username 		= '' # put your username here if you want to test.
		self.password 		= '' # Put your password here if you want to run the tests!
		self.bad_password	= '******'
		self.session = LastFMSession()
		
	def testHandshakeWithGoodCredentials(self):
		result = self.session.handshake(self.username, self.password)
		self.assertEqual(result, True)
	def testHandshakeWithBadCredentials(self):
		result = self.session.handshake(self.username, self.bad_password)
		self.assertEqual(result, False)
	def testArtistFlipChannel(self):
		result = self.session.handshake(self.username, self.password)
		self.assertEqual(result, True)
		
		result = self.session.set_artist("Jack Johnson")		
		self.assertEqual(result, True)
	
		result = self.session.set_artist("dskjhdfjksdfhuriuyr")		
		self.assertEqual(result, False)
	
	def testGettingPlayList(self):
		result = self.session.handshake(self.username, self.password)
		self.assertEqual(result, True)

		result = self.session.set_artist("Jack Johnson")		
		self.assertEqual(result, True)
		
		result = self.session.get_play_list()
		self.assertEqual(result.version, '1')
		self.failUnless(len(result.tracks) > 1)
示例#2
0
	def setUp(self):
		self.username 		= '' # put your username here if you want to test.
		self.password 		= '' # Put your password here if you want to run the tests!
		self.bad_password	= '******'
		self.session = LastFMSession()