Ejemplo n.º 1
0
    def test_order_update_view(self):
        obj = mixer.blend("order.Order")
        request = RequestFactory().get("/order")
        testUser = mixer.blend("auth.User", username="******", password="******")

        request.user = testUser
        response = OrderUpdateView.as_view()(request, pk=1)
        assert response.status_code == 200, "Should be 200 Status"
Ejemplo n.º 2
0
    def test_order_update_view_post_method(self):
        obj = mixer.blend("order.Order")
        obj.status = "INITSTATUS"
        product_obj = mixer.blend("product.Product")
        testUser = mixer.blend("auth.User", username="******", password="******")
        data = {"delivery_date": "15/12/2017", "ordernumber": 213435453, "status": "UPDATEDSTATUS",
                'productorder_set-TOTAL_FORMS': '1',
                'productorder_set-INITIAL_FORMS': '0',
                'productorder_set-MIN_NUM_FORMS': '0',
                'productorder_set-MAX_NUM_FORMS': '1000',
                'productorder_set-0-product': 1,
                'productorder_set-0-amount': 20,
                }
        assert obj.products.count() == 0, "There should be no products before request"
        request = RequestFactory().post('/', data=data)
        request.user = testUser
        response = OrderUpdateView.as_view()(request, pk=obj.pk)
        obj.refresh_from_db()
        assert obj.products.count() == 1, "There should be one products after response"

        assert response.status_code == 302, "should redirect to success page"
        assert obj.status == "UPDATEDSTATUS", "Should be updated"
Ejemplo n.º 3
0
from django.urls import path

from order import views
from order.views import OrderListView, OrderCreateView, OrderUpdateView

app_name = 'order'

urlpatterns = [
    path('', OrderListView.as_view(), name='list'),
    path('add/', OrderCreateView.as_view(), name='add'),
    path('update/<int:pk>/', OrderUpdateView.as_view(), name='update'),
    path('delete/<int:pk>/', views.order_delete, name='delete'),
]
Ejemplo n.º 4
0
]

categorie = [path('categorie/', include(categorie))]

manufirm = [path('manufirm/', include(manufirm))]

componnent = [
    path('component/', include(component)),
    path('', ComponentsListView.as_view(), name="home"),
]

acaunt = [
    path('accounts/', include('django.contrib.auth.urls')),
    path("user/", include(acaunt))
]

cards = [
    path('card/', CardListView.as_view(), name="list"),
    path('card/', include(card)),
    path("componentincard/", include(componentincard))
]

order = [
    path(
        'order/',
        OrderUpdateView.as_view(),
    ),
]

urlpatterns = admin + categorie + manufirm + componnent + acaunt + cards + order + static(
    settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Ejemplo n.º 5
0
from django.urls import path


from order.views import OrderUpdateView, OrderDeleteView, OrderListView, OrderDetailView, OrderCreateView, cart, \
    updateItem, PurchaseDetailView, PurchaseDeleteView, PurchaseListView

app_name = "order"

urlpatterns = [
    path("", OrderListView.as_view(), name="list"),
    path("create/", OrderCreateView.as_view(), name="create"),
    path("<int:pk>/", OrderDetailView.as_view(), name="detail"),
    path("<int:pk>/update/", OrderUpdateView.as_view(), name="update"),
    path("<int:pk>/delete/", OrderDeleteView.as_view(), name="delete"),
    path("cart/", cart, name="cart"),
    path("update_item/", updateItem, name="update_item"),
    path("<int:pk>/", PurchaseDetailView.as_view(), name="detail"),
    path("delete/<int:pk>/", PurchaseDeleteView.as_view(), name="delete"),
    path("", PurchaseListView.as_view(), name="list"),
]