Skip to content

Commit

Permalink
Unit test for Success and Cancel endpoints in payment app
Browse files Browse the repository at this point in the history
  • Loading branch information
DEENUU1 committed Dec 9, 2023
1 parent fe10f15 commit 36afd56
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion offer/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
urlpatterns = [
path("salary/", SalaryView.as_view(), name="salary_stats"),
path("offer/", OfferListView.as_view(), name="offer_list"),
path("offer/<int:company_id>/company/", CompanyOfferListView.as_view(), name="company_offer_list"),
path("offer/company/<int:company_id>", CompanyOfferListView.as_view(), name="company_offer_list"),
]
urlpatterns += router.urls
10 changes: 5 additions & 5 deletions tests/test_offer/test_views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
from tests.fixtures import user, job_offer, job_offer_with_company, user_second, company
from rest_framework.test import force_authenticate, APIRequestFactory
from offer.views import CompanyOfferListView, OfferListView, SalaryView, ExperienceView, EmploymentTypeView, \
from tests.fixtures import user, job_offer, job_offer_with_company, company
from rest_framework.test import APIRequestFactory
from offer.views import OfferListView, SalaryView, ExperienceView, EmploymentTypeView, \
WorkTypeView, JobOfferView
import json
from offer.models import JobOffer, WorkType, EmploymentType, Experience, Salary
from offer.models import WorkType, EmploymentType, Experience, Salary


factory = APIRequestFactory()

Expand Down
20 changes: 20 additions & 0 deletions tests/test_payment/test_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pytest
from rest_framework.test import force_authenticate, APIRequestFactory
from payment.views import SuccessView, CancelView

factory = APIRequestFactory()


@pytest.mark.django_db
def test_success_return_success_view():
request = factory.get("/payment/success")
response = SuccessView.as_view()(request)
assert response.status_code == 200



@pytest.mark.django_db
def test_success_return_cancel_view():
request = factory.get("/payment/cancel")
response = CancelView.as_view()(request)
assert response.status_code == 200

0 comments on commit 36afd56

Please sign in to comment.