mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
Add tests for frontend urls
This commit is contained in:
parent
b1b19d702c
commit
19032754aa
@ -3,7 +3,7 @@ from django.urls import path
|
||||
from .views import basic, pro
|
||||
|
||||
urlpatterns = [
|
||||
path("", basic),
|
||||
path("", basic, name="basic"),
|
||||
path("create/", basic),
|
||||
path("robot/", basic),
|
||||
path("robot/<token>", basic),
|
||||
@ -11,5 +11,5 @@ urlpatterns = [
|
||||
path("order/<int:orderId>", basic),
|
||||
path("settings/", basic),
|
||||
path("", basic),
|
||||
path("pro/", pro),
|
||||
path("pro/", pro, name="pro"),
|
||||
]
|
||||
|
19
tests/test_frontend_fetch.py
Normal file
19
tests/test_frontend_fetch.py
Normal file
@ -0,0 +1,19 @@
|
||||
from django.test import Client, TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
|
||||
class FrontendFetchTest(TestCase):
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
|
||||
def test_basic_frontend_url_content(self):
|
||||
path = reverse("basic")
|
||||
response = self.client.get(path)
|
||||
self.assertContains(response, "<html>")
|
||||
self.assertContains(response, "main.js")
|
||||
|
||||
def test_pro_frontend_url_content(self):
|
||||
path = reverse("pro")
|
||||
response = self.client.get(path)
|
||||
self.assertContains(response, "<html>")
|
||||
self.assertContains(response, "pro.js")
|
@ -5,7 +5,7 @@ from django.urls import reverse
|
||||
from api.management.commands.clean_orders import Command as CleanOrders
|
||||
from api.management.commands.follow_invoices import Command as FollowInvoices
|
||||
from api.models import Order
|
||||
from api.tasks import follow_send_payment
|
||||
from api.tasks import follow_send_payment, send_notification
|
||||
from tests.utils.node import (
|
||||
add_invoice,
|
||||
create_address,
|
||||
@ -111,6 +111,7 @@ class Trade:
|
||||
headers = self.get_robot_auth(robot_index, first_encounter)
|
||||
self.response = self.client.get(path + params, **headers)
|
||||
|
||||
@patch("api.tasks.send_notification.delay", send_notification)
|
||||
def cancel_order(self, robot_index=1):
|
||||
path = reverse("order")
|
||||
params = f"?order_id={self.order_id}"
|
||||
@ -144,6 +145,7 @@ class Trade:
|
||||
generate_blocks(create_address("robot"), 1)
|
||||
wait_nodes_sync()
|
||||
|
||||
@patch("api.tasks.send_notification.delay", send_notification)
|
||||
def publish_order(self):
|
||||
# Maker's first order fetch. Should trigger maker bond hold invoice generation.
|
||||
self.get_order()
|
||||
|
Loading…
Reference in New Issue
Block a user