Beispiel #1
0
	def test_creating_new_branch(self):
		branch = Branch ()
		branch.branch_name = "Cebuana"

		branch.save()

		all_branch_in_database = Branch.objects.all()
		self.assertEqual(len(all_branch_in_database), 1)
		only_branch_in_database = all_branch_in_database[0]
		self.assertEquals(only_branch_in_database, branch)

		self.assertEquals(only_branch_in_database.name, "Cebuana")
Beispiel #2
0
    def test_creating_new_branch(self):
        branch = Branch()
        branch.branch_name = "Cebuana"

        branch.save()

        all_branch_in_database = Branch.objects.all()
        self.assertEqual(len(all_branch_in_database), 1)
        only_branch_in_database = all_branch_in_database[0]
        self.assertEquals(only_branch_in_database, branch)

        self.assertEquals(only_branch_in_database.name, "Cebuana")
Beispiel #3
0
	def test_creating_a_new_branch_and_saving_it_to_the_database(self):
        # start by creating a new Poll object with its "question" set
		branch = Branch()
		branch.name = "Ortigas branch"
		branch.address = "Ortigas Pasig, City"
        
        # check we can save it to the database
		branch.save()

        # now check we can find it in the database again
		all_branches_in_database = Branch.objects.all()
		self.assertEquals(len(all_branches_in_database), 1)
		only_branch_in_database = all_branches_in_database[0]
		self.assertEquals(only_branch_in_database, branch)

        # and check that it's saved its two attributes: question and pub_date
		self.assertEquals(only_branch_in_database.name, "Ortigas branch")
		self.assertEquals(only_branch_in_database.address, "Ortigas Pasig, City")