Ejemplo n.º 1
0
 def test_can_use_api_token(self):
     token = get_api_token()
     response = self.client.get(
         path='/fake-view',
         HTTP_AUTHORIZATION=f"Bearer {token['access']}"
     )
     self.assertResponse200(response)
Ejemplo n.º 2
0
 def setUp(self):
     super().setUp()
     self.user = UserFactory()
     token = get_api_token(self.user)
     self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token['access']}")
     self.event = EventFactory(location__sensor__user=self.user)
     self.path = reverse('events-detail', args=(self.event.id, ))
Ejemplo n.º 3
0
 def setUp(self):
     super().setUp()
     self.user = UserFactory()
     self.sensor = SensorFactory(user=self.user)
     self.path = reverse('sensors-detail', args=(self.sensor.id,))
     token = get_api_token(self.user)
     self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token['access']}")
Ejemplo n.º 4
0
 def setUp(self):
     super().setUp()
     self.user = UserFactory()
     token = get_api_token(self.user)
     self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token['access']}")