From 3bd8497522e90901898a68dc092d0e3d527bd4dc Mon Sep 17 00:00:00 2001 From: bom Date: Wed, 22 Feb 2023 10:58:27 +0100 Subject: [PATCH] WIP Create test_services --- test/test_services.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test/test_services.py b/test/test_services.py index e69de29..085cf90 100644 --- a/test/test_services.py +++ b/test/test_services.py @@ -0,0 +1,39 @@ +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 services import InitReleaseService +from release_type import ReleaseType + +def test_init_release_service(tmp_path): + # init + file_name = 'config.json' + with open(f'test/resources/{file_name}', 'r') as gradle_file: + contents = gradle_file.read() + + f = tmp_path / file_name + f.write_text(contents) + + release_service = InitReleaseService(f) + release_service.create_release_version(commit_string='Release MINOR') + + assert '"version": "123.124.1"' in f.read_text() + + release_service.create_bump_version() + + assert '"version": "123.124.2-SNAPSHOT"' in f.read_text() \ No newline at end of file