Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Add tests for full_path() function
Browse files Browse the repository at this point in the history
This patch adds tests for the full_path() function.

Signed-off-by: Major Hayden <[email protected]>
  • Loading branch information
major committed May 14, 2018
1 parent 92bba52 commit e7e25f5
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_executable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
Test cases for runner module.
"""
# Copyright (c) 2018 Red Hat, Inc. All rights reserved. This copyrighted
# material is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General Public
# License v.2 or later.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os
import unittest

from skt import executable


class TestExecutable(unittest.TestCase):
"""Test cases for executable module"""

def test_full_path_relative(self):
"""Verify that full_path() expands a relative path"""
filename = "somefile"
result = executable.full_path(filename)
expected_path = "{}/{}".format(os.getcwd(), filename)
self.assertEqual(expected_path, result)

def test_full_path_user_directory(self):
"""Verify that full_path() expands a user directory path"""
filename = "somefile"
result = executable.full_path("~/{}".format(filename))
expected_path = "{}/{}".format(os.path.expanduser('~'), filename)
self.assertEqual(expected_path, result)

0 comments on commit e7e25f5

Please sign in to comment.