This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds tests for the full_path() function. Signed-off-by: Major Hayden <[email protected]>
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |