Skip to content

Commit

Permalink
Fix references in tests from 'rcc' to 'rrc'
Browse files Browse the repository at this point in the history
  • Loading branch information
James Bensley committed Jan 1, 2024
1 parent a15ec38 commit fa3c5d1
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 28 deletions.
32 changes: 21 additions & 11 deletions dnas/tests/test_mrt_archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,27 @@ def test_get_arch_option(self: "test_mrt_archives") -> None:
ValueError, self.mrt_a.get_arch_option, "/tmp/9jw2f8wi", "abc"
)

arch = self.mrt_a.archives[0]
filename = arch.gen_latest_upd_fn()
filepath = os.path.normpath(arch.MRT_DIR + "/" + filename)

ret = self.mrt_a.get_arch_option(filepath, "ENABLED")
self.assertIsInstance(ret, bool)
self.assertEqual(ret, True)

self.assertRaises(
AttributeError, self.mrt_a.get_arch_option, filepath, "hwiwewohh7"
)
for arch in self.mrt_a.archives:
# Find an enabled archive to test with:
if arch.ENABLED:
filename = arch.gen_latest_upd_fn()
filepath = os.path.normpath(arch.MRT_DIR + "/" + filename)

# Try to get a valid archive option
ret = self.mrt_a.get_arch_option(filepath, "ENABLED")
self.assertIsInstance(ret, bool)
self.assertEqual(ret, True)

# Try to get an invalid one
self.assertRaises(
AttributeError,
self.mrt_a.get_arch_option,
filepath,
"hwiwewohh7",
)
break
else:
raise AssertionError(f"Couldn't find enabled MRT archive")

def test_get_day_key(self: "test_mrt_archives") -> None:
self.assertRaises(ValueError, self.mrt_a.get_day_key, "")
Expand Down
10 changes: 5 additions & 5 deletions dnas/tests/test_mrt_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ def setUp(self: "test_mrt_entry") -> None:
Copy the test files to the location they would be in,
if we had downloaded them from the public archives:
"""
self.upd_1_fn = "rcc23.updates.20220421.0200.gz"
self.upd_1_fn = "rrc23.updates.20220421.0200.gz"
self.upd_1_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"RCC23/",
"RRC23/",
self.upd_1_fn,
)
if not os.path.isfile(self.upd_1_path):
raise Exception(f"Test MRT file is not found: {self.upd_1_path}")

self.entry_1_fn = "rcc23.updates.20220421.0200.mrt_entry.json"
self.entry_1_fn = "rrc23.updates.20220421.0200.mrt_entry.json"
self.entry_1_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"RCC23/",
"RRC23/",
self.entry_1_fn,
)
if not os.path.isfile(self.entry_1_path):
Expand All @@ -44,7 +44,7 @@ def setUp(self: "test_mrt_entry") -> None:

mrt_a = mrt_archives()
for arch in mrt_a.archives:
if arch.NAME == "UNIT_TEST_RCC_23":
if arch.NAME == "UNIT_TEST_RRC_23":
os.makedirs(arch.MRT_DIR, exist_ok=True)
self.upd_1_mrt = os.path.join(arch.MRT_DIR, self.upd_1_fn)

Expand Down
24 changes: 12 additions & 12 deletions dnas/tests/test_mrt_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ def setUp(self: "test_mrt_stats") -> None:
Copy the test files to the location they would be in,
if we had downloaded them from the public archives:
"""
self.upd_1_fn = "rcc23.updates.20220421.0200.gz"
self.upd_2_fn = "rcc23.updates.20220501.2305.gz"
self.upd_1_fn = "rrc23.updates.20220421.0200.gz"
self.upd_2_fn = "rrc23.updates.20220501.2305.gz"
self.upd_3_fn = "sydney.updates.20220601.0230.bz2"
self.upd_4_fn = "sydney.updates.20220601.0415.bz2"
self.upd_5_fn = "rcc01.updates.20100827.0840.gz"
self.upd_5_fn = "rrc01.updates.20100827.0840.gz"

self.upd_1_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"RCC23/",
"RRC23/",
self.upd_1_fn,
)
if not os.path.isfile(self.upd_1_path):
raise Exception(f"Test MRT file is not found: {self.upd_1_path}")

self.upd_2_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"RCC23/",
"RRC23/",
self.upd_2_fn,
)
if not os.path.isfile(self.upd_2_path):
Expand All @@ -60,17 +60,17 @@ def setUp(self: "test_mrt_stats") -> None:
raise Exception(f"Test MRT file is not found: {self.upd_4_path}")

self.upd_5_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "RCC1/", self.upd_5_fn
os.path.dirname(os.path.realpath(__file__)), "RRC1/", self.upd_5_fn
)
if not os.path.isfile(self.upd_5_path):
raise Exception(f"Test MRT file is not found: {self.upd_5_path}")

mrt_a = mrt_archives()
for arch in mrt_a.archives:
if arch.NAME == "UNIT_TEST_RCC_1":
if arch.NAME == "UNIT_TEST_RRC_1":
os.makedirs(arch.MRT_DIR, exist_ok=True)
self.upd_5_mrt = os.path.join(arch.MRT_DIR, self.upd_5_fn)
if arch.NAME == "UNIT_TEST_RCC_23":
if arch.NAME == "UNIT_TEST_RRC_23":
os.makedirs(arch.MRT_DIR, exist_ok=True)
self.upd_1_mrt = os.path.join(arch.MRT_DIR, self.upd_1_fn)
self.upd_2_mrt = os.path.join(arch.MRT_DIR, self.upd_2_fn)
Expand Down Expand Up @@ -100,7 +100,7 @@ def setUp(self: "test_mrt_stats") -> None:

self.upd_1_json = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"RCC23/",
"RRC23/",
self.upd_1_fn + ".json",
)
if not os.path.isfile(self.upd_1_json):
Expand All @@ -120,7 +120,7 @@ def setUp(self: "test_mrt_stats") -> None:

self.upd_5_json = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"RCC1/",
"RRC1/",
self.upd_5_fn + ".json",
)
if not os.path.isfile(self.upd_3_json):
Expand All @@ -130,8 +130,8 @@ def setUp(self: "test_mrt_stats") -> None:

self.upd_1_test = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"RCC23/",
"rcc23.updates.20220421.0200.gz.test",
"RRC23/",
"rrc23.updates.20220421.0200.gz.test",
)

def test_init(self: "test_mrt_stats") -> None:
Expand Down

0 comments on commit fa3c5d1

Please sign in to comment.