Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyashaChiza committed Aug 17, 2024
1 parent f27cdc1 commit c0548e5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions stegnography/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
from PIL import Image
from stegano import lsb



class EncodeViewTests(TestCase):

def setUp(self):
self.client = Client()
# Ensure MEDIA_ROOT directory exists
os.makedirs(settings.MEDIA_ROOT, exist_ok=True)
self.encode_url = reverse('encode') # Update this if your URL pattern is different

def test_encode_view_post(self):
Expand Down Expand Up @@ -89,14 +89,16 @@ class DownloadFileTests(TestCase):

def setUp(self):
self.client = Client()
self.download_url = reverse('download', kwargs={'file_name': 'test_file.png'}) # Update this if your URL pattern is different

# Create a dummy file for testing
self.file_name = 'test_file.png'
self.file_path = os.path.join(settings.MEDIA_ROOT, self.file_name)
# Ensure MEDIA_ROOT directory exists
os.makedirs(settings.MEDIA_ROOT, exist_ok=True)
# Create a dummy file for testing
with open(self.file_path, 'wb') as f:
f.write(b'This is a test file')

self.download_url = reverse('download', kwargs={'file_name': self.file_name}) # Update this if your URL pattern is different

def test_download_file_success(self):
response = self.client.get(self.download_url)
self.assertEqual(response.status_code, 200)
Expand Down

0 comments on commit c0548e5

Please sign in to comment.