dda-devops-build/test/test_git_handler.py

31 lines
658 B
Python
Raw Normal View History

2023-02-21 14:08:39 +00:00
from pathlib import Path
import sys
import os
# getting the name of the directory
# where the this file is present.
current = os.path.dirname(os.path.realpath(__file__))
# Getting the parent directory name
# where the current directory is present.
parent = os.path.dirname(current)
# adding the parent directory to
# the sys.path.
sys.path.append(parent)
# now we can import the module in the parent
# directory.
from git_handler import *
def test_git_handler():
# init
repo = GitRepo()
repo.get_commits()
#test
assert type(repo.commits) == dict
assert repo.commits["decd36b"] == ["(tag:refs/tags/TEST)", "Initial commit"]