Skip to content

Commit

Permalink
Remove unused imports and add test constants
Browse files Browse the repository at this point in the history
Signed-off-by: pem70 <[email protected]>
  • Loading branch information
pem70 committed Jun 7, 2024
1 parent bc4069f commit e491f73
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 132 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"./src/zos_console",
"./src/zos_files",
"./src/zos_jobs",
"./src/zosmf"
"./src/zosmf",
"./src/zos_tso"
],
}
1 change: 0 additions & 1 deletion src/zos_files/zowe/zos_files_for_zowe_sdk/uss.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def get_content(self, filepath_name):
A JSON with the contents of the specified USS file
"""
custom_args = self._create_custom_request_arguments()
# custom_args["params"] = {"filepath-name": filepath_name}
custom_args["url"] = "{}fs{}".format(self.request_endpoint, filepath_name)
response_json = self.request_handler.perform_request("GET", custom_args)
return response_json
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/files/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
11 changes: 3 additions & 8 deletions tests/unit/files/datasets/test_copy.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
from unittest import TestCase, mock
from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestCreateClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_copy_uss_to_dataset(self, mock_send_request):
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/files/datasets/test_create.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestCreateClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_create_data_set_accept_valid_recfm(self, mock_send_request):
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/files/datasets/test_delete.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestDeleteClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_delete(self, mock_send_request):
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/files/datasets/test_get.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestGetClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_get(self, mock_send_request):
Expand Down
14 changes: 3 additions & 11 deletions tests/unit/files/datasets/test_list.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
"""Unit tests for the Zowe Python SDK z/OS Files package."""
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestFilesClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_list_dsn(self, mock_send_request):
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/files/datasets/test_migrate.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestCreateClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_recall_migrated_dataset(self, mock_send_request):
Expand Down
12 changes: 3 additions & 9 deletions tests/unit/files/datasets/test_rename.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestCreateClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_rename_dataset(self, mock_send_request):
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/files/datasets/test_write.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestWriteClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_write(self, mock_send_request):
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/files/file_systems/test_file_systems.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
"""Unit tests for the Zowe Python SDK z/OS Files package."""
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files, exceptions
from unit.files.constants import profile


class TestFilesClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_create_zFS_file_system(self, mock_send_request):
Expand Down
13 changes: 3 additions & 10 deletions tests/unit/files/uss/test_uss.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
"""Unit tests for the Zowe Python SDK z/OS Files package."""
import re
from unittest import TestCase, mock

from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets
from zowe.zos_files_for_zowe_sdk import Files
from unit.files.constants import profile


class TestFilesClass(TestCase):
"""File class unit tests."""

def setUp(self):
"""Setup fixtures for File class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

@mock.patch("requests.Session.send")
def test_delete_uss(self, mock_send_request):
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/test_zos_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import unittest
from unittest import mock

from unit.files.constants import profile
from zowe.zos_console_for_zowe_sdk import Console


Expand All @@ -11,13 +11,7 @@ class TestConsoleClass(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Console class."""
self.session_details = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.session_details = profile

def test_object_should_be_instance_of_class(self):
"""Created object should be instance of Console class."""
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/test_zos_jobs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unit tests for the Zowe Python SDK z/OS Jobs package."""

from unittest import TestCase, mock

from unit.files.constants import profile
from zowe.zos_jobs_for_zowe_sdk import Jobs


Expand All @@ -10,13 +10,7 @@ class TestJobsClass(TestCase):

def setUp(self):
"""Setup fixtures for Jobs class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

def test_object_should_be_instance_of_class(self):
"""Created object should be instance of Jobs class."""
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/test_zos_tso.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unit tests for the Zowe Python SDK z/OS TSO package."""

from unittest import TestCase, mock

from unit.files.constants import profile
from zowe.zos_tso_for_zowe_sdk import Tso


Expand All @@ -10,13 +10,7 @@ class TestTsoClass(TestCase):

def setUp(self):
"""Setup fixtures for Tso class."""
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.test_profile = profile

def test_object_should_be_instance_of_class(self):
"""Created object should be instance of Tso class."""
Expand Down
10 changes: 2 additions & 8 deletions tests/unit/test_zosmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import unittest
from unittest import mock

from unit.files.constants import profile
from zowe.zosmf_for_zowe_sdk import Zosmf


Expand All @@ -11,13 +11,7 @@ class TestZosmfClass(unittest.TestCase):

def setUp(self):
"""Setup fixtures for Zosmf class."""
self.connection_dict = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
"port": 443,
"rejectUnauthorized": True,
}
self.connection_dict = profile

def test_object_should_be_instance_of_class(self):
"""Created object should be instance of Zosmf class."""
Expand Down

0 comments on commit e491f73

Please sign in to comment.