Skip to content

Commit

Permalink
Add tests for extendedSupport column
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotwutingfeng committed Jan 24, 2024
1 parent c417fdd commit f54f22b
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/norwegianblue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _tabulate(
"discontinued",
"support",
"eol",
"extendedSupport",
"extended support",
):
if preferred in headers:
new_headers.append(preferred)
Expand Down
11 changes: 11 additions & 0 deletions tests/data/expected_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,14 @@
| 3.3 | 2012-09-29 | 3.3.7 | 2017-09-19 | 2017-09-29 |
| 2.7 | 2010-07-03 | 2.7.18 | 2020-04-19 | 2020-01-01 |
"""

EXPECTED_MD_RHEL = """
| cycle | release | latest | latest release | support | eol | extended support |
|:------|:----------:|:-------|:--------------:|:----------:|:----------:|:----------------:|
| 9 LTS | 2022-05-17 | 9.3 | 2023-11-07 | 2027-05-31 | 2032-05-31 | 2035-05-31 |
| 8 LTS | 2019-05-07 | 8.9 | 2023-11-14 | 2024-05-31 | 2029-05-31 | 2032-05-31 |
| 7 LTS | 2013-12-11 | 7.9 | 2020-09-29 | 2019-08-06 | 2024-06-30 | 2028-06-30 |
| 6 LTS | 2010-11-09 | 6.10 | 2018-06-19 | 2016-05-10 | 2020-11-30 | 2024-06-30 |
| 5 LTS | 2007-03-15 | 5.11 | 2014-09-16 | 2013-01-08 | 2017-03-31 | 2020-11-30 |
| 4 | 2005-02-15 | 4.9 | 2011-02-16 | 2009-03-31 | 2012-02-29 | 2017-03-31 |
"""
65 changes: 65 additions & 0 deletions tests/data/sample_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,71 @@
]
"""

SAMPLE_RESPONSE_JSON_RHEL = """
[
{
"cycle": "9",
"releaseDate": "2022-05-17",
"support": "2027-05-31",
"eol": "2032-05-31",
"lts": "2032-05-31",
"extendedSupport": "2035-05-31",
"latest": "9.3",
"latestReleaseDate": "2023-11-07"
},
{
"cycle": "8",
"releaseDate": "2019-05-07",
"support": "2024-05-31",
"eol": "2029-05-31",
"lts": "2029-05-31",
"extendedSupport": "2032-05-31",
"latest": "8.9",
"latestReleaseDate": "2023-11-14"
},
{
"cycle": "7",
"releaseDate": "2013-12-11",
"support": "2019-08-06",
"eol": "2024-06-30",
"lts": "2024-06-30",
"extendedSupport": "2028-06-30",
"latest": "7.9",
"latestReleaseDate": "2020-09-29"
},
{
"cycle": "6",
"releaseDate": "2010-11-09",
"support": "2016-05-10",
"eol": "2020-11-30",
"lts": "2020-11-30",
"extendedSupport": "2024-06-30",
"latest": "6.10",
"latestReleaseDate": "2018-06-19"
},
{
"cycle": "5",
"releaseDate": "2007-03-15",
"support": "2013-01-08",
"eol": "2017-03-31",
"lts": "2017-03-31",
"extendedSupport": "2020-11-30",
"latest": "5.11",
"latestReleaseDate": "2014-09-16"
},
{
"cycle": "4",
"releaseDate": "2005-02-15",
"support": "2009-03-31",
"eol": "2012-02-29",
"extendedSupport": "2017-03-31",
"latest": "4.9",
"latestReleaseDate": "2011-02-16",
"lts": false
}
]
"""

SAMPLE_RESPONSE_JSON_UBUNTU = """
[
{
Expand Down
5 changes: 5 additions & 0 deletions tests/test_norwegianblue.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
EXPECTED_MD_COLOUR,
EXPECTED_MD_LOG4J,
EXPECTED_MD_PYTHON,
EXPECTED_MD_RHEL,
EXPECTED_PRETTY,
EXPECTED_PRETTY_WITH_TITLE,
EXPECTED_RST,
Expand All @@ -32,6 +33,7 @@
SAMPLE_RESPONSE_ALL_JSON,
SAMPLE_RESPONSE_JSON_LOG4J,
SAMPLE_RESPONSE_JSON_PYTHON,
SAMPLE_RESPONSE_JSON_RHEL,
SAMPLE_RESPONSE_JSON_UBUNTU,
)

Expand Down Expand Up @@ -110,6 +112,9 @@ def test_norwegianblue_formats(
pytest.param(
"python", SAMPLE_RESPONSE_JSON_PYTHON, EXPECTED_MD_PYTHON, id="python"
),
pytest.param(
"rhel", SAMPLE_RESPONSE_JSON_RHEL, EXPECTED_MD_RHEL, id="rhel"
),
],
)
def test_norwegianblue_products(
Expand Down

0 comments on commit f54f22b

Please sign in to comment.