Private
Public Access
1
0

Testing seems to hang

This commit is contained in:
Sander Roosendaal
2016-11-25 16:22:39 +01:00
parent af3396cfee
commit 88da49a00e

View File

@@ -38,6 +38,7 @@ class DjangoTestCase(TestCase, MockTestCase):
class C2Objects(DjangoTestCase):
def test_strokedata(self):
print "C2 strokedata"
with open('rowers/testdata/c2stroketestdata.txt','r') as infile:
res = json.load(infile)
@@ -59,6 +60,7 @@ class C2Objects(DjangoTestCase):
class StravaObjects(DjangoTestCase):
def test_strokedata(self):
print "STRAVA strokedata"
timejson = json.load(open('rowers/testdata/stravatimetestdata.txt','r'))
velojson = json.load(open('rowers/testdata/stravavelotestdata.txt','r'))
distancejson = json.load(open('rowers/testdata/stravadistancetestdata.txt','r'))
@@ -134,6 +136,7 @@ class StravaObjects(DjangoTestCase):
class STObjects(DjangoTestCase):
def test_strokedata(self):
print "SportTracks strokedata"
with open('rowers/testdata/sporttrackstestdata.txt','r') as infile:
data = json.load(infile)
@@ -149,6 +152,8 @@ class STObjects(DjangoTestCase):
class TestErrorPages(TestCase):
def test_error_handlers(self):
print "Error Handlers"
self.assertTrue(urls.handler404.endswith('.error404_view'))
self.assertTrue(urls.handler500.endswith('.error500_view'))
factory = RequestFactory()
@@ -173,6 +178,7 @@ class WorkoutTests(TestCase):
duration="0:55:00",distance=8000)
def test_checkworkoutuser(self):
print "Check Workout User"
u = User.objects.get(username='john')
r = Rower.objects.get(user=u)
w = Workout.objects.get(user=r)
@@ -192,6 +198,7 @@ class C2Tests(TestCase):
duration="0:55:00",distance=8000)
def c2_notokentest(self):
print "C2 No token"
thetoken = c2_open(self.u)
# should raise C2NoTokenError
self.assertRaises(C2NoTokenError)
@@ -206,6 +213,7 @@ class DataTest(TestCase):
def test_workoutform(self):
print "Workout Form"
form_data = {
'name':'test',
'date':'2016-05-01',
@@ -219,6 +227,7 @@ class DataTest(TestCase):
self.assertTrue(form.is_valid())
def test_rower_form_withvalidnumbers(self):
print "Workout Form with Valid Numbers"
form_data = {
'max':192,
'rest':48,
@@ -234,6 +243,7 @@ class DataTest(TestCase):
def test_rower_form_twoequalvalues(self):
print "Workout Form Error"
form_data = {
'max':192,
'rest':48,
@@ -248,6 +258,7 @@ class DataTest(TestCase):
self.assertFalse(form.is_valid())
def test_rower_form_abovemaxallowed(self):
print "Workout Form Error 2"
form_data = {
'max':300,
'rest':48,
@@ -262,6 +273,7 @@ class DataTest(TestCase):
self.assertFalse(form.is_valid())
def test_rower_form_wrongorder(self):
print "Workout form error 3"
form_data = {
'max':192,
'rest':48,
@@ -276,6 +288,7 @@ class DataTest(TestCase):
self.assertFalse(form.is_valid())
def test_rower_form_belowminalloed(self):
print "Workout form error 4"
form_data = {
'max':192,
'rest':2,
@@ -290,6 +303,7 @@ class DataTest(TestCase):
self.assertFalse(form.is_valid())
def test_rower_form_wrongorder2(self):
print "Workout form error 5"
form_data = {
'max':192,
'rest':48,
@@ -304,6 +318,7 @@ class DataTest(TestCase):
self.assertFalse(form.is_valid())
def test_painsled(self):
print "Test Painsled"
filename = 'C:\\python\\rowingdata\\testdata\\testdata.csv'
f = open(filename,'rb')
file_data = {'file': SimpleUploadedFile(f.name, f.read())}
@@ -385,6 +400,7 @@ class ViewTest(TestCase):
self.nu = datetime.datetime.now()
def test_upload_view_notloggedin(self):
print "Upload not logged in"
response = self.c.post('/rowers/workout/upload/',follow=True)
@@ -394,6 +410,7 @@ class ViewTest(TestCase):
self.assertEqual(response.status_code, 200)
def test_upload_view_sled(self):
print "Upload painsled"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\testdata.csv'
@@ -436,6 +453,7 @@ class ViewTest(TestCase):
def test_upload_view_notloggedin(self):
print "Upload not logged in"
response = self.c.post('/rowers/workout/upload/',follow=True)
@@ -445,6 +463,7 @@ class ViewTest(TestCase):
self.assertEqual(response.status_code, 200)
def test_upload_view_sled_negativetime(self):
print "Painsled error"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\tim.csv'
@@ -486,6 +505,7 @@ class ViewTest(TestCase):
def test_upload_view_sled_noname(self):
print "Upload no name"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\testdata.csv'
@@ -519,6 +539,7 @@ class ViewTest(TestCase):
def test_upload_view_TCX_CN(self):
print "Upload TCX"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\crewnerddata.tcx'
@@ -562,6 +583,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_TCX_SpeedCoach2(self):
print "Upload TCX 2"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\Speedcoach2example.csv'
@@ -592,6 +614,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_TCX_SpeedCoach2(self):
print "Upload TCX 3"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\Speedcoach2example.csv'
@@ -624,6 +647,7 @@ class ViewTest(TestCase):
def test_upload_view_TCX_SpeedCoach2(self):
print "Upload TCX 3"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\speedcoach3test3.csv'
@@ -654,6 +678,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_TCX_NoHR(self):
print "Upload TCX no HR"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\NoHR.tcx'
@@ -684,6 +709,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_TCX_CN(self):
print "Upload TCX 10"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\rowinginmotionexample.tcx'
@@ -711,6 +737,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_RP(self):
print "Upload RowPro"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\RP_testdata.csv'
@@ -738,6 +765,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_Mystery(self):
print "Upload Mystery"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\mystery.csv'
@@ -765,6 +793,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_RP_interval(self):
print "Upload RowPro Interval"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\RP_interval.csv'
@@ -792,6 +821,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_sled_desktop(self):
print "Upload Painsled Desktop"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\painsled_desktop_example.csv'
@@ -819,6 +849,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_sled_ergdata(self):
print "Upload Ergdata"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\ergdata_example.csv'
@@ -846,6 +877,7 @@ class ViewTest(TestCase):
os.remove(f_to_be_deleted)
def test_upload_view_sled_ergstick(self):
print "Upload Ergstick"
self.c.login(username='john',password='koeinsloot')
filename = 'C:\\python\\rowingdata\\testdata\\ergstick.csv'
@@ -922,6 +954,7 @@ class subroutinetests(TestCase):
def c2stuff(self):
print "Test C2 Stuff"
data = c2stuff.createc2workoutdata(self.w)
jsond = json.dumps(data)
data = c2stuff.createc2workoutdata_as_splits(w)
@@ -967,6 +1000,7 @@ class PlotTests(TestCase):
def test_ote_plots(self):
print "Plots"
w = self.wote
f1 = 'testdata.csv'[:-4]
timestr = strftime("%Y%m%d-%H%M%S")
@@ -1074,6 +1108,7 @@ class PlotTests(TestCase):
os.remove(fullpathimagename)
def test_otw_plots(self):
print "Plots 2"
w = self.wotw
f1 = 'testdata.csv'[:-4]
timestr = strftime("%Y%m%d-%H%M%S")