Skip to content

Commit

Permalink
Add unit test for issue tso command
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <[email protected]>
  • Loading branch information
t1m0thyj committed Mar 13, 2024
1 parent ad0ca59 commit 1f7e150
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/unit/test_zos_tso.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""Unit tests for the Zowe Python SDK z/OS TSO package."""

import unittest
from unittest import TestCase, mock

from zowe.zos_tso_for_zowe_sdk import Tso


class TestTsoClass(unittest.TestCase):
class TestTsoClass(TestCase):
"""Tso class unit tests."""

def setUp(self):
"""Setup fixtures for Tso class."""
self.connection_dict = {
self.test_profile = {
"host": "mock-url.com",
"user": "Username",
"password": "Password",
Expand All @@ -20,5 +20,16 @@ def setUp(self):

def test_object_should_be_instance_of_class(self):
"""Created object should be instance of Tso class."""
tso = Tso(self.connection_dict)
tso = Tso(self.test_profile)
self.assertIsInstance(tso, Tso)

@mock.patch("requests.Session.send")
def test_issue_command(self, mock_send_request):
"""Test issuing a command sends a request"""
fake_response = {"servletKey": None, "tsoData": "READY"}
mock_send_request.return_value = mock.Mock(
headers={"Content-Type": "application/json"}, status_code=200, json=lambda: fake_response
)

Tso(self.test_profile).issue_command("TIME")
self.assertEqual(mock_send_request.call_count, 3)

0 comments on commit 1f7e150

Please sign in to comment.