Skip to content

Commit

Permalink
Updated references to scenario verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplisticCode committed Dec 20, 2023
1 parent 24a5006 commit 49e95bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
20 changes: 12 additions & 8 deletions external_tester/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,31 @@ def compareCSV(expected, actual):
else:
print(f"ERROR: {expected} doest not exist!")
return False

def comparText(file1, file2):

def compareTexts(expectedText, actualText):
remove = str.maketrans('', '', string.whitespace)
expectedText = expectedText.translate(remove)
actualLines = actualText.translate(remove)
return expectedText == actualLines

def compareFiles(file1, file2):
expectedFile = open(file1, 'r')
actualFile = open(file2, 'r')
remove = str.maketrans('', '', string.whitespace)
expectedLines = expectedFile.readlines()
actualLines = actualFile.readlines()
expectedLines = "".join(expectedLines).translate(remove)
actualLines = "".join(actualLines).translate(remove)
expectedLines = "".join(expectedLines)
actualLines = "".join(actualLines)
expectedFile.close()
actualFile.close()

return expectedLines == actualLines
return compareTexts(expectedLines, actualLines)

def compare(strPrefix, expected, actual):
if os.path.exists(expected):
convert(expected)

compareResult = filecmp.cmp(expected, actual)
if not compareResult:
compareRes = comparText(expected, actual)
compareRes = compareFiles(expected, actual)
if not compareRes:
print("ERROR: {}: Files {} and {} do not match".format(strPrefix, expected, actual))
return False
Expand Down
2 changes: 1 addition & 1 deletion external_tester/webapi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def testScenarioController(basicUrl):

expectedMasterModel = bytes(expectedMasterModel, "utf-8").decode("unicode_escape")

if(not testutils.compare("Generate from scenario", expectedMasterModel, actualMasterModel)):
if(not testutils.compareTexts(expectedMasterModel, actualMasterModel)):
print("ERROR: actual and expected master model do not match")
print("Actual:")
print(json.dumps(actualMasterModel, indent=2))
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.2.3</version>

<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
Expand Down Expand Up @@ -354,7 +354,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.2.3</version>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.jetbrains.dokka</groupId>-->
Expand Down

0 comments on commit 49e95bb

Please sign in to comment.