added a test
This commit is contained in:
@@ -34,26 +34,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="grid_2">
|
|
||||||
<h1>Facebook Group</h1>
|
|
||||||
|
|
||||||
<p>We run a facebook group where you can post questions and report problems,
|
|
||||||
especially if you think the wider user community benefits from the answers.</p>
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://www.facebook.com/groups/rowsandall/">https://www.facebook.com/groups/rowsandall/</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="grid_2">
|
|
||||||
<h1>Twitter</h1>
|
|
||||||
|
|
||||||
<p>You can also check me on Twitter:
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://twitter.com/rowsandall">https://twitter.com/rowsandall</a>
|
|
||||||
</ul>
|
|
||||||
When the site is down, this is the appropriate channel to look for apologies, updates, and offer help.
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h1>Rowsandall s.r.o.</h1>
|
<h1>Rowsandall s.r.o.</h1>
|
||||||
|
|||||||
@@ -110,12 +110,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p class="midden">
|
|
||||||
<a class="twitter-follow-button"
|
|
||||||
href="https://twitter.com/rowsandall">
|
|
||||||
Follow @rowsandall</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
<p class="midden">
|
<p class="midden">
|
||||||
Local Time: {% now "jS F Y H:i" %}
|
Local Time: {% now "jS F Y H:i" %}
|
||||||
|
|||||||
@@ -23,6 +23,59 @@ from django.utils.crypto import get_random_string
|
|||||||
|
|
||||||
from django.http.response import Http404
|
from django.http.response import Http404
|
||||||
|
|
||||||
|
@override_settings(TESTING=True)
|
||||||
|
class PlanStepTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.u = UserFactory()
|
||||||
|
|
||||||
|
self.r = Rower.objects.create(user=self.u,
|
||||||
|
birthdate=faker.profile()['birthdate'],
|
||||||
|
gdproptin=True, ftpset=True,surveydone=True,
|
||||||
|
gdproptindate=timezone.now(),
|
||||||
|
rowerplan='pro', eurocredits=100)
|
||||||
|
|
||||||
|
self.c = Client()
|
||||||
|
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
||||||
|
self.factory = RequestFactory()
|
||||||
|
self.password = faker.word()
|
||||||
|
self.u.set_password(self.password)
|
||||||
|
self.u.save()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
for workout in self.user_workouts:
|
||||||
|
try:
|
||||||
|
os.remove(workout.csvfilename)
|
||||||
|
except (IOError, FileNotFoundError,OSError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_createplannedsession(self):
|
||||||
|
ps = PlannedSession(
|
||||||
|
startdate=nu.date(),
|
||||||
|
enddate=(nu+datetime.timedelta(days=1)).date(),
|
||||||
|
sessiontype='session',
|
||||||
|
sessionmode = 'time',
|
||||||
|
preferreddate=nu.date(),
|
||||||
|
sessionvalue = 60,
|
||||||
|
sessionunit='min',
|
||||||
|
manager=self.u,
|
||||||
|
sessionsport='water',
|
||||||
|
criterium='none',
|
||||||
|
interval_string='4x(5min@20spm+5min@22spm)',
|
||||||
|
name='test',
|
||||||
|
)
|
||||||
|
ps.save()
|
||||||
|
ps.rower.add(self.r)
|
||||||
|
|
||||||
|
self.assertEqual(ps.rower.count(),1)
|
||||||
|
steps = ps.steps
|
||||||
|
|
||||||
|
self.assertEqual(len(steps['steps']),3)
|
||||||
|
|
||||||
|
s = ps.steps_intervals()
|
||||||
|
expected = '\n\n4x\n- 300s 20rpm Active 0\n- 300s 22rpm Active 1\n\n'
|
||||||
|
self.assertEqual(s,expected)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(TESTING=True)
|
@override_settings(TESTING=True)
|
||||||
class TrainingPlanTest(TestCase):
|
class TrainingPlanTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -33,7 +86,7 @@ class TrainingPlanTest(TestCase):
|
|||||||
gdproptin=True, ftpset=True,surveydone=True,
|
gdproptin=True, ftpset=True,surveydone=True,
|
||||||
defaulttimezone='US/Pacific',
|
defaulttimezone='US/Pacific',
|
||||||
gdproptindate=timezone.now(),
|
gdproptindate=timezone.now(),
|
||||||
rowerplan='pro')
|
rowerplan='pro', eurocredits=100)
|
||||||
|
|
||||||
self.c = Client()
|
self.c = Client()
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
||||||
@@ -200,7 +253,7 @@ class SessionTemplateTest(TestCase):
|
|||||||
birthdate=faker.profile()['birthdate'],
|
birthdate=faker.profile()['birthdate'],
|
||||||
gdproptin=True, ftpset=True,surveydone=True,
|
gdproptin=True, ftpset=True,surveydone=True,
|
||||||
gdproptindate=timezone.now(),
|
gdproptindate=timezone.now(),
|
||||||
rowerplan='pro')
|
rowerplan='pro', eurocredits=100)
|
||||||
|
|
||||||
self.c = Client()
|
self.c = Client()
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
||||||
@@ -551,7 +604,7 @@ class SessionCompleteTest(TestCase):
|
|||||||
birthdate=faker.profile()['birthdate'],
|
birthdate=faker.profile()['birthdate'],
|
||||||
gdproptin=True, ftpset=True,surveydone=True,
|
gdproptin=True, ftpset=True,surveydone=True,
|
||||||
gdproptindate=timezone.now(),
|
gdproptindate=timezone.now(),
|
||||||
rowerplan='pro')
|
rowerplan='pro', eurocredits=100)
|
||||||
|
|
||||||
self.c = Client()
|
self.c = Client()
|
||||||
|
|
||||||
@@ -1246,7 +1299,7 @@ class PlannedSessionsView(TestCase):
|
|||||||
gdproptin=True, ftpset=True,surveydone=True,
|
gdproptin=True, ftpset=True,surveydone=True,
|
||||||
gdproptindate=timezone.now(),
|
gdproptindate=timezone.now(),
|
||||||
defaulttimezone='US/Pacific',
|
defaulttimezone='US/Pacific',
|
||||||
rowerplan='pro')
|
rowerplan='pro', eurocredits=100)
|
||||||
self.r.save()
|
self.r.save()
|
||||||
self.c = Client()
|
self.c = Client()
|
||||||
|
|
||||||
@@ -1671,6 +1724,10 @@ description: ""
|
|||||||
response = self.c.get(url,follow=True)
|
response = self.c.get(url,follow=True)
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
# count number of PlannedSession objects for self.r
|
||||||
|
ps = PlannedSession.objects.filter(rower__in=[self.r])
|
||||||
|
self.assertEqual(ps.count(),5)
|
||||||
|
|
||||||
def test_clone_view(self):
|
def test_clone_view(self):
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
login = self.c.login(username=self.u.username, password=self.password)
|
||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
@@ -2336,3 +2393,32 @@ description: ""
|
|||||||
response = self.c.post(url,form_data,follow=True)
|
response = self.c.post(url,form_data,follow=True)
|
||||||
|
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
# add a plan
|
||||||
|
url = reverse('rower_view_instantplan', kwargs={'id':self.instantplan.uuid})
|
||||||
|
response = self.c.get(url)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
form_data = {
|
||||||
|
'name': 'Test Plan',
|
||||||
|
'startdate':datetime.datetime.now().strftime('%Y-%m-%d'),
|
||||||
|
'enddate':(datetime.datetime.now()+datetime.timedelta(days=self.instantplan.duration)).strftime('%Y-%m-%d'),
|
||||||
|
'plan_past_days': False,
|
||||||
|
'datechoice':'startdate',
|
||||||
|
'notes': faker.word(),
|
||||||
|
'byrscore': False,
|
||||||
|
'target': '',
|
||||||
|
}
|
||||||
|
form = InstantPlanSelectForm(form_data)
|
||||||
|
self.assertTrue(form.is_valid())
|
||||||
|
form = PlanByRscoreForm(form_data)
|
||||||
|
self.assertTrue(form.is_valid())
|
||||||
|
|
||||||
|
# post the form to url
|
||||||
|
response = self.c.post(url,form_data,follow=True)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
# check the number of PlannedSession objects
|
||||||
|
ps = PlannedSession.objects.filter(rower__in=[self.r])
|
||||||
|
self.assertEqual(ps.count(),5)
|
||||||
|
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -2060,6 +2060,7 @@ def plannedsession_tointervals_view(request, id=0):
|
|||||||
startdate, enddate = get_dates_timeperiod(request)
|
startdate, enddate = get_dates_timeperiod(request)
|
||||||
startdate = startdate.date()
|
startdate = startdate.date()
|
||||||
enddate = enddate.date()
|
enddate = enddate.date()
|
||||||
|
|
||||||
|
|
||||||
ps = get_object_or_404(PlannedSession, pk=id)
|
ps = get_object_or_404(PlannedSession, pk=id)
|
||||||
|
|
||||||
|
|||||||
@@ -75,23 +75,6 @@
|
|||||||
}(document, 'script', 'facebook-jssdk'));</script>
|
}(document, 'script', 'facebook-jssdk'));</script>
|
||||||
<link rel="stylesheet" href="https://webapiv2.navionics.com/dist/webapi/webapi.min.css" >
|
<link rel="stylesheet" href="https://webapiv2.navionics.com/dist/webapi/webapi.min.css" >
|
||||||
<script type="text/javascript" src="https://webapiv2.navionics.com/dist/webapi/webapi.min.no-dep.js"></script>
|
<script type="text/javascript" src="https://webapiv2.navionics.com/dist/webapi/webapi.min.no-dep.js"></script>
|
||||||
<script>window.twttr = (function(d, s, id) {
|
|
||||||
var js, fjs = d.getElementsByTagName(s)[0],
|
|
||||||
t = window.twttr || {};
|
|
||||||
if (d.getElementById(id)) return t;
|
|
||||||
js = d.createElement(s);
|
|
||||||
js.id = id;
|
|
||||||
js.async=true;
|
|
||||||
js.src = "https://platform.twitter.com/widgets.js";
|
|
||||||
fjs.parentNode.insertBefore(js, fjs);
|
|
||||||
|
|
||||||
t._e = [];
|
|
||||||
t.ready = function(f) {
|
|
||||||
t._e.push(f);
|
|
||||||
};
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}(document, "script", "twitter-wjs"));</script>
|
|
||||||
|
|
||||||
<script type='text/javascript'
|
<script type='text/javascript'
|
||||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
|
|||||||
@@ -65,25 +65,6 @@
|
|||||||
<link rel="stylesheet" href="https://webapiv2.navionics.com/dist/webapi/webapi.min.css" >
|
<link rel="stylesheet" href="https://webapiv2.navionics.com/dist/webapi/webapi.min.css" >
|
||||||
<script type="text/javascript" src="https://webapiv2.navionics.com/dist/webapi/webapi.min.no-dep.js"></script>
|
<script type="text/javascript" src="https://webapiv2.navionics.com/dist/webapi/webapi.min.no-dep.js"></script>
|
||||||
<script src="https://kit.fontawesome.com/8ec1edfba3.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/8ec1edfba3.js" crossorigin="anonymous"></script>
|
||||||
<script>
|
|
||||||
window.twttr = (function(d, s, id) {
|
|
||||||
var js, fjs = d.getElementsByTagName(s)[0],
|
|
||||||
t = window.twttr || {};
|
|
||||||
if (d.getElementById(id)) return t;
|
|
||||||
js = d.createElement(s);
|
|
||||||
js.id = id;
|
|
||||||
js.async=true;
|
|
||||||
js.src = "https://platform.twitter.com/widgets.js";
|
|
||||||
fjs.parentNode.insertBefore(js, fjs);
|
|
||||||
|
|
||||||
t._e = [];
|
|
||||||
t.ready = function(f) {
|
|
||||||
t._e.push(f);
|
|
||||||
};
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}(document, "script", "twitter-wjs"));
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script id="script-batch" type="text/javascript">
|
<script id="script-batch" type="text/javascript">
|
||||||
(function(d){
|
(function(d){
|
||||||
|
|||||||
@@ -77,23 +77,6 @@
|
|||||||
}(document, 'script', 'facebook-jssdk'));</script>
|
}(document, 'script', 'facebook-jssdk'));</script>
|
||||||
<link rel="stylesheet" href="https://webapiv2.navionics.com/dist/webapi/webapi.min.css" >
|
<link rel="stylesheet" href="https://webapiv2.navionics.com/dist/webapi/webapi.min.css" >
|
||||||
<script type="text/javascript" src="https://webapiv2.navionics.com/dist/webapi/webapi.min.no-dep.js"></script>
|
<script type="text/javascript" src="https://webapiv2.navionics.com/dist/webapi/webapi.min.no-dep.js"></script>
|
||||||
<script>window.twttr = (function(d, s, id) {
|
|
||||||
var js, fjs = d.getElementsByTagName(s)[0],
|
|
||||||
t = window.twttr || {};
|
|
||||||
if (d.getElementById(id)) return t;
|
|
||||||
js = d.createElement(s);
|
|
||||||
js.id = id;
|
|
||||||
js.async=true;
|
|
||||||
js.src = "https://platform.twitter.com/widgets.js";
|
|
||||||
fjs.parentNode.insertBefore(js, fjs);
|
|
||||||
|
|
||||||
t._e = [];
|
|
||||||
t.ready = function(f) {
|
|
||||||
t._e.push(f);
|
|
||||||
};
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}(document, "script", "twitter-wjs"));</script>
|
|
||||||
|
|
||||||
<script type='text/javascript'
|
<script type='text/javascript'
|
||||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
|
|||||||
Reference in New Issue
Block a user