Пример #1
0
	def test_update_location(self):
		project = Project.create(name='tomate', description='tomatensalat', url='hallo')
		Location.create(title='funfunfun', lat=0.0, lng=0.0, description='nochmehrfun', project=project)
		response = self.client.put('/tomate/funfunfun/', '{"description":"wenigerfunohhhh"}', **{'Authorization':'Bearer '+self.login.token()})
		self.assertEqual(response.status_code, 200)
		location = Location.objects.get(title='funfunfun')
		self.assertEqual(location.description, 'wenigerfunohhhh')
Пример #2
0
	def test_delete_location(self):
		project = Project.create(name='tomate', description='tomatensalat', url='hallo')
		Location.create(title='funfunfun', lat=0.0, lng=0.0, description='nochmehrfun', project=project)
		response = self.client.delete('/tomate/funfunfun/', **{'Authorization':'Bearer '+self.login.token()})
		self.assertEqual(response.status_code, 200)
		location = Location.objects.filter(title='funfunfun')
		self.assertEqual(len(location), 0)
Пример #3
0
	def test_get_location(self):
		project = Project.create(name='tomate', description='tomatensalat', url='hallo')
		Location.create(title='funfunfun', lat=0.0, lng=0.0, description='nochmehrfun', project=project)
		response = self.client.get('/tomate/funfunfun/', **{'Authorization':'Bearer '+self.login.token()})
		self.assertEqual(response.status_code, 200)
		data = response.content.decode('utf-8')
		self.assertJSONEqual(data, {'title':'funfunfun', 'description':'nochmehrfun', 'lat':0.0, 'lng':0.0})