Private
Public Access
1
0

Added simple test for C2 Stroke data

This commit is contained in:
sanderroosendaal
2016-11-06 17:55:51 +01:00
parent 464550deb9
commit 1a1b1d403f
4 changed files with 28 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ from rowers.tasks import handle_makeplot
from rowers.c2stuff import C2NoTokenError
from minimocktest import MockTestCase
import pandas as pd
import json
@@ -25,7 +25,7 @@ from rowers.views import error500_view,error404_view,error400_view,error403_view
class DjangoTestCase(TestCase, MockTestCase):
def _pre_setup(self):
MockTestCase.setup(self)
MockTestCase.setUp(self)
TestCase._pre_setup(self)
self.client = Client()
@@ -35,6 +35,29 @@ class DjangoTestCase(TestCase, MockTestCase):
# Create your tests here.
class C2Objects(DjangoTestCase):
def test_strokedata(self):
with open('c2stroketestdata.txt','r') as infile:
res = json.load(infile)
strokedata = pd.DataFrame.from_dict(res['data'])
with open('c2testdata.txt','r') as infile:
res = json.load(infile)
data = res['data']
from rowers.views import add_workout_from_strokedata
u = User.objects.create_user('john',
'sander@ds.ds',
'koeinsloot')
r = Rower.objects.create(user=u)
res = add_workout_from_strokedata(u,1,data,strokedata,source='c2')
class TestErrorPages(TestCase):
def test_error_handlers(self):
self.assertTrue(urls.handler404.endswith('.error404_view'))