mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 15:53:07 +02:00
tests: Add simple test for monthly ghistory
This commit is contained in:
parent
451a0773da
commit
9a3a619791
1 changed files with 33 additions and 1 deletions
|
@ -41,7 +41,7 @@ class TestCalendarSimple(IntegrationTest):
|
||||||
assert any(day in line for line in output)
|
assert any(day in line for line in output)
|
||||||
|
|
||||||
|
|
||||||
class TestGhistorySimple(IntegrationTest):
|
class TestGhistoryAnnualSimple(IntegrationTest):
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
dict(description="test task"),
|
dict(description="test task"),
|
||||||
|
@ -65,3 +65,35 @@ class TestGhistorySimple(IntegrationTest):
|
||||||
|
|
||||||
current_year = local_zone.localize(datetime.now()).year
|
current_year = local_zone.localize(datetime.now()).year
|
||||||
assert str(current_year) in '\n'.join(output)
|
assert str(current_year) in '\n'.join(output)
|
||||||
|
|
||||||
|
|
||||||
|
class TestGhistoryMonthlySimple(IntegrationTest):
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
dict(description="test task"),
|
||||||
|
dict(description="completed task 1", status="completed", end="now"),
|
||||||
|
dict(description="completed task 2", status="completed", end="now"),
|
||||||
|
dict(description="deleted task", status="deleted"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
self.command("TaskWikiGhistoryMonthly")
|
||||||
|
assert self.command(":py print vim.current.buffer", silent=False).startswith("<buffer ghistory.monthly")
|
||||||
|
output = self.read_buffer()
|
||||||
|
|
||||||
|
header_words = ("Year", "Month", "Number", "Added", "Completed", "Deleted")
|
||||||
|
for word in header_words:
|
||||||
|
assert word in output[0]
|
||||||
|
|
||||||
|
legend_words = ("Legend", "Added", "Completed", "Deleted")
|
||||||
|
for word in legend_words:
|
||||||
|
assert re.search(word, output[-1], re.IGNORECASE)
|
||||||
|
|
||||||
|
current_year = local_zone.localize(datetime.now()).year
|
||||||
|
current_month_number = local_zone.localize(datetime.now()).month
|
||||||
|
months = ["January", "February", "March", "April",
|
||||||
|
"May", "June", "July", "August",
|
||||||
|
"September", "October", "November", "December"]
|
||||||
|
|
||||||
|
assert str(current_year) in '\n'.join(output)
|
||||||
|
assert str(months[current_month_number - 1]) in '\n'.join(output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue