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)
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, ))
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']}")
def setUp(self): super().setUp() self.user = UserFactory() token = get_api_token(self.user) self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token['access']}")