def test_site_forward_cascade(self):
		"""
		Deleting a site should delete all the associated nodes

		"""
		SiteSeeder.seed_ricefield_site(n_nodes = 3)
		assert Site.query.count() == 1
		assert Node.query.count() > 0
		Site.query.delete()
		assert Site.query.count() == 0
		assert Node.query.count() == 0
	def test_site_backwards_cascade(self):
		"""
		Deleting an object referenced by a site should NOT delete the site
		"""
		SiteSeeder.seed_ricefield_site(n_nodes = 3)
		assert Site.query.count() == 1
		assert Node.query.count() > 0
		
		n_deleted = Node.query.delete()
		
		assert n_deleted == 3
		assert Site.query.count() == 1
		assert Node.query.count() == 0
	def test_site_json_method(self):
		site = SiteSeeder.seed_ricefield_site()
		site_json = site.json()
		JSONHelper.test_model_json_method(Site, site_json)
Beispiel #4
0
 def test_ricefield_site_returns_site_with_one_node(self):
     site = SiteSeeder.seed_ricefield_site()
     assert isinstance(site, Site)
     assert len(site.nodes) == 1
Beispiel #5
0
	def test_ricefield_site_returns_site_with_one_node(self):
		site = SiteSeeder.seed_ricefield_site()
		assert isinstance(site, Site)
		assert len(site.nodes) == 1