Esempio n. 1
0
	def test_get_subsribers(self):
		user1= User.objects.create_user('Mar2','*****@*****.**','j1')
		user3= User.objects.create_user('koupepia','*****@*****.**','m1')
		user4= User.objects.create_user('Ginnis1','*****@*****.**','m1')
		tour = Tour()
		tour.owner_id = user1
		tour.save()
		tour.subscribers.add(user3, user4)
		tour.name = "Open Day"
		# tour.tour_date = "2010-12-12"
		tour.save()
		self.assertEqual(get_subscribers("Open Day").count(),2)
Esempio n. 2
0
	def test_get_owner(self):
		user1 = User.objects.create_user('John','*****@*****.**','j1')
		user2= User.objects.create_user('Mike','*****@*****.**','m1')
		user3= User.objects.create_user('kokoko','*****@*****.**','m1')
		user4= User.objects.create_user('lalal','*****@*****.**','m1')
		tour = Tour()
		tour.id = "1"
		tour.name = "hello"
		tour.owner_id = user1
		tour.save()
		self.assertEqual(get_owner("hello"),'John')
Esempio n. 3
0
	def test_delete_tour(self):
		user1 = User.objects.create_user('kokokoko','*****@*****.**','j1')
		user2= User.objects.create_user('kk','*****@*****.**','m1')
		user3= User.objects.create_user('ff','*****@*****.**','m1')
		user4= User.objects.create_user('dd','*****@*****.**','m1')
		tour = Tour()
		tour.id = "1"
		n = tour.name = "hello"
		tour.owner_id = user1
		tour.save()
		delete_tour(n)
		tour1 = Tour()
		n1 = tour1.name = "hello"
		tour1.owner_id = user1
		tour1.save()
		self.assertEqual(get_owner("hello"), "kokokoko")