fixed sporttracks bug
This commit is contained in:
@@ -781,7 +781,7 @@ def mocked_requests(*args, **kwargs):
|
|||||||
if ststrokestester.match(args[0]).group(1) == '13':
|
if ststrokestester.match(args[0]).group(1) == '13':
|
||||||
return MockResponse(ststrokesjson_nogps,200)
|
return MockResponse(ststrokesjson_nogps,200)
|
||||||
else:
|
else:
|
||||||
return MockResponse(strokesjson,200)
|
return MockResponse(ststrokesjson,200)
|
||||||
if stuploadtester.match(args[0]):
|
if stuploadtester.match(args[0]):
|
||||||
json_data = {
|
json_data = {
|
||||||
"uris": [
|
"uris": [
|
||||||
|
|||||||
@@ -445,6 +445,19 @@ class STObjects(DjangoTestCase):
|
|||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
@patch('rowers.imports.requests.get', side_effect=mocked_requests)
|
||||||
|
def test_sporttracks_import_all(self, mock_get):
|
||||||
|
|
||||||
|
response = self.c.get('/rowers/workout/sporttracksimport/all/',follow=True)
|
||||||
|
|
||||||
|
expected_url = reverse('workouts_view')
|
||||||
|
|
||||||
|
self.assertRedirects(response,
|
||||||
|
expected_url=expected_url,
|
||||||
|
status_code=302,target_status_code=200)
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
@patch('rowers.dataprep.create_engine')
|
@patch('rowers.dataprep.create_engine')
|
||||||
def test_strokedata(self, mocked_sqlalchemy):
|
def test_strokedata(self, mocked_sqlalchemy):
|
||||||
with open('rowers/tests/testdata/sporttrackstestdata.txt','r') as infile:
|
with open('rowers/tests/testdata/sporttrackstestdata.txt','r') as infile:
|
||||||
|
|||||||
@@ -1551,12 +1551,11 @@ def workout_getsporttracksworkout_all(request):
|
|||||||
])
|
])
|
||||||
newids = [stid for stid in stids if not stid in knownstids]
|
newids = [stid for stid in stids if not stid in knownstids]
|
||||||
for sporttracksid in newids:
|
for sporttracksid in newids:
|
||||||
res = sporttracksstuff.get_sporttracks_workout(
|
data,strokedata = sporttracksstuff.get_workout(
|
||||||
request.user,sporttracksid)
|
request.user,sporttracksid)
|
||||||
data = res.json()
|
|
||||||
|
|
||||||
id,message = add_workout_from_stdata(
|
id,message = sporttracksstuff.add_workout_from_data(
|
||||||
request.user,sporttracksid,data
|
request.user,sporttracksid,data,strokedata
|
||||||
)
|
)
|
||||||
if id==0:
|
if id==0:
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|||||||
Reference in New Issue
Block a user