|
@@ -0,0 +1,21 @@
|
|
|
+import pytest
|
|
|
+from django.urls import reverse
|
|
|
+from rest_framework.test import APIClient
|
|
|
+from unittest.mock import patch
|
|
|
+
|
|
|
+def test_post_method(django_db_setup):
|
|
|
+ # Create a client to make requests
|
|
|
+ client = APIClient()
|
|
|
+
|
|
|
+ # Define your test url and token
|
|
|
+ test_url = 'http://test.com'
|
|
|
+ test_token = 'test_token'
|
|
|
+
|
|
|
+ # Make a post request to your view
|
|
|
+ response = client.post(reverse('xml-generator-view'), {'url': test_url, 'token': test_token}) # Replace 'xml_generator_view' with your actual view name
|
|
|
+
|
|
|
+ # Assert the status code is 200
|
|
|
+ assert response.status_code == 200
|
|
|
+ # Assert the content type is 'text/xml'
|
|
|
+ assert response['content-type'] == 'text/xml'
|
|
|
+ # Here you can add your additional asserts (like checking the response content)
|