diff --git a/neuropy/neuropy/templates/neuropy/about.html b/neuropy/neuropy/templates/neuropy/about.html index 3d3a33e..fa366e3 100644 --- a/neuropy/neuropy/templates/neuropy/about.html +++ b/neuropy/neuropy/templates/neuropy/about.html @@ -12,7 +12,7 @@

About Neuropy

A personalized priority app to support a Cognitive Behavioral Therapy (CBT) approach to efficiently organize your day according to a struggle/disorder that is effectively treated by CBT. CBT is a goal-oriented pyschotherapy treatment, taking a hands-on approach to problem solving. Goal of CBT is to change the patterns of thinking or behavior that are behind a person's difficulties, modifying their feelings and therefore their thinking and behavior overtime.

-

Neuropy Considers what the habit/disorder the user wants to treat with CBT, along with medication, it's half-life and peak periods. Also works around black-out periods on user's schedule by syncing with Google Calender, personal preference or most productive period of the day for user, and finally considers time commitments for each activity. Each "TO-DO" will be ranked considering these aspects and will be worked into periods of the day.

+

Neuropy Considers what the habit/disorder the user wants to treat with CBT, along with medication, its efficacy, and peak periods. Also works around black-out periods on user's schedule by syncing with Google Calender, personal preference or most productive period of the day for user, and finally considers time commitments for each activity. Each "TO-DO" will be ranked considering these aspects and will be worked into periods of the day.

Join Today! @@ -40,7 +40,7 @@

Amos Bolder

Claire Gatenby

Image
-
I am a born and bred Australian who made the wild decision to quit my job and move to Seattle where I am learning how to code. I dream of using my past life as a scientist and my new skills as a developer to move into bioinformatics. I love cats, staying active, travelling, the outdoors and taking photos. I am Python developer.
+
I am a born and bred Australian who made the wild decision to quit my job and move to Seattle where I am learning how to code. I dream of using my past life as a scientist and my new skills as a developer to move into bioinformatics. I love cats, staying active, traveling, the outdoors and taking photos. I am Python developer.
@@ -54,7 +54,7 @@

Patrick Saunders

-
+
diff --git a/neuropy/todo/tests.py b/neuropy/todo/tests.py index 3063461..2911911 100644 --- a/neuropy/todo/tests.py +++ b/neuropy/todo/tests.py @@ -4,10 +4,12 @@ from django.test import TestCase, Client, RequestFactory from django.urls import reverse_lazy +from todo.views import create_event_list from todo.models import Todo from userprofile.models import Profile import factory from bs4 import BeautifulSoup +import datetime class TodoFactory(factory.django.DjangoModelFactory): @@ -120,6 +122,30 @@ def setUp(self): self.users = [UserFactory.create() for i in range(20)] self.todos = [TodoFactory.create() for i in range(20)] + def generate_todos(self): + """Generate todos.""" + user = self.users[5] + todo1 = self.todos[0] + todo2 = self.todos[2] + todo1.owner, todo2.owner = user.profile, user.profile + + todo1.date = datetime.date.today() + todo2.date = datetime.date.today() + + todo1.ease = 1 + todo2.ease = 2 + + todo1.priority = 2 + todo2.priority = 3 + + todo1.duration = 1 + todo2.duration = 2 + + user.save() + todo1.save() + todo2.save() + return user.profile, [todo1, todo2] + def make_user_and_login(self): """Make user and login.""" add_user_group() @@ -144,7 +170,6 @@ def test_todo_list_route_is_status_ok(self): response = self.client.get(reverse_lazy("list_todo")) self.assertTrue(response.status_code == 200) - def test_todo_list_route_uses_right_templates(self): """Test todo list returns the right templates.""" self.client.force_login(self.users[0]) response = self.client.get(reverse_lazy("list_todo")) @@ -435,6 +460,60 @@ def test_edit_todo_saves_db_and_shows_to_detail_todo_view(self): self.assertTrue('

Duration: 3

' in html) self.assertTrue('

Description: Then Buy 7/11

' in html) + def test_todo_ease_level_is_correct(self): + """Test todo ease level is correct.""" + profile, todos = self.generate_todos() + todos = create_event_list("CONCERTA", profile) + self.assertTrue(len(todos) == 2) + + def test_todo_is_in_order(self): + """Test todo is arranged in right order.""" + profile, todo_lst = self.generate_todos() + todos = create_event_list("CONCERTA", profile) + self.assertTrue(todos[0]['title'] == todo_lst[1].title) + self.assertTrue(todos[1]['title'] == todo_lst[0].title) + + def test_todos_are_correct_ease_level(self): + """Test todo is assigned to correct ease levels.""" + profile, todo_lst = self.generate_todos() + todos = create_event_list("CONCERTA", profile) + self.assertTrue(todos[0]['ease'] == 'hard') + self.assertTrue(todos[1]['ease'] == 'medium') + + def test_todo_created_on_profile_on_wrong_date(self): + """Test todo is created for current date.""" + user = self.users[5] + todo1 = self.todos[0] + todo2 = self.todos[2] + todo1.owner, todo2.owner = user.profile, user.profile + + todo1.date = datetime.date(1, 2, 3) + todo2.date = datetime.date(1, 2, 3) + + todo1.ease = 1 + todo2.ease = 2 + + todo1.priority = 2 + todo2.priority = 3 + + todo1.duration = 1 + todo2.duration = 2 + + user.save() + todo1.save() + todo2.save() + + events = create_event_list('CONCERTA', user.profile) + self.assertFalse(events) + + def test_todo_duration(self): + """Test todo duration is equal to diff between end and start time of todo.""" + profile, todo_lst = self.generate_todos() + todos = create_event_list("CONCERTA", profile) + diff_todos_1 = todos[1]['end'] - todos[1]['start'] + self.assertTrue(datetime.timedelta(hours=todo_lst[0].duration) == diff_todos_1) + + def test_logged_out_todo_fails(self): """Test that a logged out user cannot create a todo.""" response = self.client.get(reverse_lazy('add_todo'))