Skip to content

Commit

Permalink
Resolve the unittest error in the initial 0.10.14 release (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
corthon and [email protected] authored Jul 2, 2021
1 parent c41953c commit b019ce4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions edk2toollib/windows/capsule/inf_generator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
import unittest
import tempfile
import os
import datetime
from edk2toollib.windows.capsule.inf_generator import InfGenerator, InfSection


def _get_test_file():
return TEST_FILE_CONTENTS.replace("<DATESUB>", datetime.date.today().strftime("%m/%d/%Y"))


class InfSectionTest(unittest.TestCase):
def test_empty(self):
section = InfSection('TestSection')
Expand Down Expand Up @@ -66,7 +71,7 @@ def test_file(self):
file_contents = inffile.read()
# Remove all whitespace, just in case.
file_contents = file_contents.replace("\n", "").replace("\t", "").replace(" ", "")
test_contents = TEST_FILE_CONTENTS.replace("\n", "").replace("\t", "").replace(" ", "")
test_contents = _get_test_file().replace("\n", "").replace("\t", "").replace(" ", "")
self.assertEqual(test_contents, file_contents)

def test_integrity_file_entry(self):
Expand Down Expand Up @@ -129,6 +134,8 @@ def test_invalid_guid_format(self):
InfGenerator("test_name", "provider", "NOT A VALID GUID", "x64", "description", "aa.bb", "0x1000000")


# NOTE: Below are the expected contents of a a valid INF file.
# Some fields will need to be generated (like the date).
TEST_FILE_CONTENTS = ''';
; TestName.inf
; 1.2.3.4
Expand All @@ -139,7 +146,7 @@ def test_invalid_guid_format(self):
Class=Firmware
ClassGuid={f2e7dd72-6468-4e36-b6f1-6488f42c1b52}
Provider=%Provider%
DriverVer=06/10/2021,1.2.3.4
DriverVer=<DATESUB>,1.2.3.4
PnpLockdown=1
CatalogFile=TestName.cat
Expand Down

0 comments on commit b019ce4

Please sign in to comment.