def test_update_delete_shipment_note(client_alice, shipment, shipment_notes): url = reverse('shipment-notes-detail', kwargs={'version': 'v1', 'shipment_pk': shipment.id, 'pk': shipment_notes[0].id}) update_note_data = {'message': 'Update message!'} # A note object cannot be updated response = client_alice.patch(url, update_note_data) AssertionHelper.HTTP_405(response) # Similarly, a note object cannot be deleted response = client_alice.delete(url) AssertionHelper.HTTP_405(response)
def test_only_post_calls(self, api_client, tracking_data): signed_tracking_data = self.sign_tracking(tracking_data, self.device) response = api_client.get(self.url_device) AssertionHelper.HTTP_405(response) response = api_client.put(self.url_device, data={'payload': signed_tracking_data}) AssertionHelper.HTTP_405(response) response = api_client.patch(self.url_device, data={'payload': signed_tracking_data}) AssertionHelper.HTTP_405(response) response = api_client.delete(self.url_device) AssertionHelper.HTTP_405(response)
def test_deletion(self, new_access_request_bob, client_alice, client_bob): response = client_alice.delete(self.detail_url) AssertionHelper.HTTP_405(response) response = client_bob.delete(self.detail_url) AssertionHelper.HTTP_405(response)
def test_unauthenticated_user_fails(self, api_client): response = api_client.get(self.url) AssertionHelper.HTTP_405(response, vnd=False, error='Unable to list sensors when not profiles is not enabled.')
def test_no_del_calls(self, api_client): response = api_client.delete(self.random_telemetry_url) AssertionHelper.HTTP_405(response)
def test_no_patch_calls(self, api_client, create_signed_telemetry_post): response = api_client.patch(self.random_telemetry_url, create_signed_telemetry_post) AssertionHelper.HTTP_405(response)
def test_owner_cannot_update(self, client_alice, url_permission_link_detail): response = client_alice.patch( url_permission_link_detail, {'expiration_date': datetime.utcnow() + timedelta(days=1)}) AssertionHelper.HTTP_405(response)
def test_owner_cannot_retrieve(self, client_alice, url_permission_link_detail): response = client_alice.get(url_permission_link_detail) AssertionHelper.HTTP_405(response)
def test_method_not_available(self, client_alice): response = client_alice.delete(self.document_alice_url) AssertionHelper.HTTP_405(response)
def test_random_url_fails(self, client_alice): response = client_alice.delete(self.random_url) AssertionHelper.HTTP_405(response)