first
This commit is contained in:
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
71
tests/test_add.py
Normal file
71
tests/test_add.py
Normal file
@@ -0,0 +1,71 @@
|
||||
from datetime import time
|
||||
|
||||
from pytest import fixture
|
||||
|
||||
from app.add import (
|
||||
split_time_range_string,
|
||||
add_up_timesheet,
|
||||
find_time_ranges,
|
||||
parse_time,
|
||||
subtract_times,
|
||||
)
|
||||
from config import SAMPLE_TIMESHEET_PATH
|
||||
|
||||
|
||||
@fixture
|
||||
def timesheet() -> str:
|
||||
with open(SAMPLE_TIMESHEET_PATH) as fin:
|
||||
return fin.read()
|
||||
|
||||
|
||||
@fixture
|
||||
def string_with_no_times():
|
||||
return "## no times here 123"
|
||||
|
||||
|
||||
@fixture
|
||||
def time_range_strings():
|
||||
return ["9:30-12:30", "8:30-7:30"]
|
||||
|
||||
|
||||
@fixture
|
||||
def time_ranges():
|
||||
return [["9:30", "12:30"], ["8:30", "7:30"]]
|
||||
|
||||
|
||||
@fixture
|
||||
def times():
|
||||
return [(time(9, 30), time(12, 30)), (time(8, 30), time(7, 30))]
|
||||
|
||||
|
||||
@fixture
|
||||
def string_with_times():
|
||||
return "## 9:30-12:30, 8:30-7:30 "
|
||||
|
||||
|
||||
def test_add_up_timesheet(timesheet):
|
||||
assert add_up_timesheet(timesheet) == 430
|
||||
|
||||
|
||||
def test_find_time_ranges_none(string_with_no_times):
|
||||
assert find_time_ranges(string_with_no_times) == []
|
||||
|
||||
|
||||
def test_find_time_ranges(string_with_times, time_range_strings):
|
||||
assert find_time_ranges(string_with_times) == time_range_strings
|
||||
|
||||
|
||||
def test_split_time_range_string(time_range_strings, time_ranges):
|
||||
for time_range_string, time_range_tuple in zip(time_range_strings, time_ranges):
|
||||
assert split_time_range_string(time_range_string) == time_range_tuple
|
||||
|
||||
|
||||
def test_parse_time(time_ranges, times):
|
||||
for time_range_tuple, time_tuple in zip(time_ranges, times):
|
||||
for time_string, time_ in zip(time_range_tuple, time_tuple):
|
||||
assert parse_time(time_string) == time_
|
||||
|
||||
|
||||
def test_subtract_times(times):
|
||||
assert subtract_times(*times[0]) == 180
|
||||
assert subtract_times(*times[1]) == 1380
|
||||
50
tests/timesheet.md
Normal file
50
tests/timesheet.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# 30 Aug - 1 Sep 2019
|
||||
|
||||
## 6.5 hours total
|
||||
invoiced on 2 Sep 2019 (#6766)
|
||||
|
||||
Gathering requirements, defining scope of work, producing specification and implementation timeline
|
||||
documents.
|
||||
|
||||
# 2 Sep 2019
|
||||
TOTAL: 430 minutes
|
||||
|
||||
## 9:45-10:15
|
||||
Researching and answering Evgeny's question about Mailwizz, SES, and email metrics reporting.
|
||||
|
||||
## 10:50-12:54
|
||||
Step 3: Making a Jinja template for the newsletter.
|
||||
|
||||
## 12:54-13:17, 14:04-14:12
|
||||
Step 4: Test sending the newsletter.
|
||||
|
||||
## 14:12-14:19
|
||||
Project scaffolding, installing dependencies, setting up remote git repository.
|
||||
|
||||
## 14:19-15:05
|
||||
More step 4:
|
||||
- writing tests for the render function
|
||||
- setting up data for test using sample newsletter
|
||||
- make sure special characters like "&" are escaped (they are in the instantiation of env in
|
||||
render.py)
|
||||
|
||||
## 15:05-15:33, 15:42-16:27
|
||||
Step 6 and 7: Make dummy allocation list and write a function to send a rendered newsletter.
|
||||
- making one small media CSV
|
||||
- making one small allocation CSV
|
||||
- making buckets on my own account (not Syllabus) for testing
|
||||
|
||||
## 16:38-16:56
|
||||
- writing to Evgeny to update about rendering from templates
|
||||
|
||||
## 16:56-17:05
|
||||
Step 7
|
||||
- uploading small media CSV to bucket
|
||||
- writing function
|
||||
|
||||
## 17:05-17:44
|
||||
Adding a few features to admin page spec, asking clarifying questions.
|
||||
Writing "status" email.
|
||||
|
||||
## 19:55-20:48
|
||||
Writing CSV-getting and -parsing for users, media, and allocation
|
||||
Reference in New Issue
Block a user