Private
Public Access
1
0

test otw testpower

This commit is contained in:
Sander Roosendaal
2021-01-16 09:57:32 +01:00
parent 264e7132dd
commit 3a6021d579
4 changed files with 1208 additions and 0 deletions

View File

@@ -10,6 +10,17 @@ import pandas as pd
nu = datetime.datetime.now()
from rowers import tasks
class fakejob:
def __init__(self):
self.id = 1
class fakerequest:
def __init__(self):
self.id = 1
self.job = fakejob()
# asynchronous tasks
class AsyncTaskTests(TestCase):
def setUp(self):
@@ -280,3 +291,23 @@ class AsyncTaskTests(TestCase):
res = tasks.handle_c2_import_stroke_data(c2token,c2id,workoutid,starttimeunix,csvfilename)
self.assertEqual(res,1)
@patch('rowers.tasks.grpc',side_effect=mocked_grpc)
@patch('rowers.tasks.send_template_email',side_effect=mocked_send_template_email)
def test_handle_otwsetpower(self,mocked_send_template_email,mocked_grpc):
f1 = result = get_random_file(filename='rowers/tests/testdata/sprintervals.csv')['filename']
boattype = '1x'
boatclass = 'water'
coastalbrand = 'other'
weightvalue = 80.
first_name = self.u.first_name
last_name = self.u.last_name
email = self.u.email
workoutid = self.wwater.id
job = fakerequest()
res = tasks.handle_otwsetpower(f1,boattype,boatclass,coastalbrand,
weightvalue,first_name,last_name,email,workoutid,
jobkey='23')
self.assertEqual(res,1)