Skip to content

Commit 0debeb0

Browse files
schedutronniranjan94
authored andcommitted
Split tests
1 parent 220fda3 commit 0debeb0

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
"""Test file for storage functions."""
2+
from unittest import TestCase
23

34
from app.api.helpers.storage import create_url
4-
from tests.unittests.setup_database import Setup
5-
from tests.unittests.utils import OpenEventTestCase
65

76

8-
class TestStorageHelperValidation(OpenEventTestCase):
7+
class TestStorageHelperValidation(TestCase):
98
"""Test class for testing storage helper functions."""
109

11-
def setUp(self):
12-
"""Method to set up app for testing."""
13-
self.app = Setup.create_app()
14-
15-
def test_create_url(self):
16-
"""Method to test the create_url function."""
10+
def test_arbitrary_url(self):
11+
"""Method to test a url with arbitrary port."""
1712

1813
request_url = 'https://localhost:5000'
1914
file_relative_path = '/some/path/image.png'
@@ -22,13 +17,19 @@ def test_create_url(self):
2217
self.assertEqual(
2318
create_url(request_url, file_relative_path), expected_file_url
2419
)
25-
request_url = 'https://localhost:443'
26-
expected_file_url = 'https://localhost/some/path/image.png'
27-
self.assertEqual(
28-
create_url(request_url, file_relative_path), expected_file_url
29-
)
20+
21+
def test_http_url(self):
22+
"""Method to test a url with port 80."""
3023
request_url = 'http://localhost:80'
3124
expected_file_url = 'http://localhost/some/path/image.png'
3225
self.assertEqual(
33-
create_url(request_url, file_relative_path), expected_file_url
26+
create_url(request_url, '/some/path/image.png'), expected_file_url
27+
)
28+
29+
def test_https_url(self):
30+
"""Method to test a url with port 443."""
31+
request_url = 'https://localhost:443'
32+
expected_file_url = 'https://localhost/some/path/image.png'
33+
self.assertEqual(
34+
create_url(request_url, '/some/path/image.png'), expected_file_url
3435
)

0 commit comments

Comments
 (0)