Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tnaccarato committed Apr 15, 2024
1 parent 33844a5 commit 6f8569d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
10 changes: 1 addition & 9 deletions payapp/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@
from timestamp_server import thrift_server

class PayAppViewTests(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
# Start the Thrift server in a separate thread
cls.thrift_server_thread = Thread(target=thrift_server.start_thrift_server)
cls.thrift_server_thread.daemon = True
cls.thrift_server_thread.start()

@classmethod
def tearDownClass(cls):
super().tearDownClass()
# Stop the Thrift server
thrift_server.stop_thrift_server()
print('Thrift server stopped.')

def setUp(self):
super().setUp()
self.client = Client()
# Create a user and an admin user
self.user = User.objects.create_user(username='user', password='userpassword')
Expand Down
14 changes: 3 additions & 11 deletions register/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from threading import Thread
from unittest.mock import patch
from django.test import TestCase
from django.test import TestCase, Client
from django.urls import reverse
from django.contrib.auth.models import User, Group
from register.forms import UserForm, LoginForm
Expand All @@ -10,23 +10,15 @@

class UserViewTests(TestCase):

@classmethod
def setUpClass(cls):
super().setUpClass()
# Start the Thrift server in a separate thread
cls.thrift_server_thread = Thread(target=thrift_server.start_thrift_server)
cls.thrift_server_thread.daemon = True
cls.thrift_server_thread.start()

@classmethod
def tearDownClass(cls):
super().tearDownClass()
# Stop the Thrift server
thrift_server.stop_thrift_server()
print('Thrift server stopped.')

def setUp(self):
super().setUp()
# Setup code for the tests, like creating a user or a group if needed
self.client = Client()
# self.admin_group = Group.objects.create(name='AdminGroup')
User.objects.create_user(username='testuser1',first_name='Test',last_name='User' ,password='testpassword123', email='test@example.com')

Expand Down

0 comments on commit 6f8569d

Please sign in to comment.