Commit d920b8d3 authored by Andreas N. Digernes's avatar Andreas N. Digernes
Browse files

Merge branch 'backend/refactor/docstrings_and_comments' into 'master'

Removed Docstrings And Comments

See merge request !39
parents 731c1130 27f18760
Pipeline #129194 passed with stages
in 2 minutes and 48 seconds
from django.contrib import admin
# Register your models here.
from .models import Comment
admin.site.register(Comment)
......@@ -4,7 +4,6 @@ from django.db import models
from workouts.models import Workout
# Create your models here.
class Comment(models.Model):
"""Django model for a comment left on a workout.
......
......@@ -63,7 +63,6 @@ def create_user(username):
def create_exercises(amount):
# create >10 exercise types for pagination testing
exerciseSerializer = ExerciseSerializer()
for i in range(amount):
valid_data = create_exercise_data(
......
......@@ -102,7 +102,6 @@ class BlackBoxTestServer(LiveServerTestCase):
self.driver.get(url)
def login(self, user: LoginData):
"""Log in a user and wait until redirected to the workouts page."""
self.get("login.html")
self.assertEqual("Login", self.driver.title)
username_input = self.driver.find_element_by_name("username")
......@@ -113,7 +112,6 @@ class BlackBoxTestServer(LiveServerTestCase):
self.wait.until(lambda driver: driver.title == "Workouts")
def logout(self):
"""Log out a user and wait until redirected to the home page."""
self.get("logout.html")
self.assertEqual("Logout", self.driver.title)
self.wait.until(lambda driver: driver.title == "Home")
......@@ -37,7 +37,7 @@ class FilterWorkoutsTest(BlackBoxTestServer):
self.login(user)
self.get("workouts.html")
self.assertEqual("Workouts", self.driver.title)
time.sleep(2) # :)
time.sleep(2)
self.get_input_value(By.ID, "filter-exercise")
options = self.driver.find_elements_by_tag_name("option")
self.assertEqual(len(options), 3)
......@@ -49,7 +49,7 @@ class FilterWorkoutsTest(BlackBoxTestServer):
self.login(user)
self.get("workouts.html")
self.assertEqual("Workouts", self.driver.title)
time.sleep(2) # :)
time.sleep(2)
options = self.driver.find_elements_by_class_name("workout")
self.assertEqual(len(options), 5)
select = Select((self.driver.find_element_by_id("filter-exercise")))
......
......@@ -37,7 +37,7 @@ class FilterWorkoutsTest(BlackBoxTestServer):
self.login(user)
self.get("highscores.html")
self.assertEqual("Highscores", self.driver.title)
time.sleep(2) # :)
time.sleep(2)
highscores = self.driver.find_elements_by_css_selector("#highscore-content>tr")
self.assertEqual(len(highscores), 2)
......@@ -46,7 +46,7 @@ class FilterWorkoutsTest(BlackBoxTestServer):
self.login(user)
self.get("highscores.html")
self.assertEqual("Highscores", self.driver.title)
time.sleep(2) # :)
time.sleep(2)
highscores = self.driver.find_elements_by_css_selector("#highscore-content>tr")
self.assertEqual(highscores[0].text, "1 arya 2")
self.assertEqual(highscores[1].text, "2 syrio 1")
......@@ -56,7 +56,7 @@ class FilterWorkoutsTest(BlackBoxTestServer):
self.login(user)
self.get("highscores.html")
self.assertEqual("Highscores", self.driver.title)
time.sleep(2) # :)
time.sleep(2)
select = Select((self.driver.find_element_by_id("filter-exercise")))
select.select_by_visible_text("Fencing")
time.sleep(2)
......
......@@ -4,7 +4,6 @@ from django.db import models
class User(AbstractUser):
"""Standard Django User model with an added field for a user's coach."""
coach = models.ForeignKey(
"self", on_delete=models.CASCADE, related_name="athletes", blank=True, null=True
......
"""Module for registering models from workouts app to admin page so that they
appear."""
from django.contrib import admin
from .models import Exercise
......
"""AppConfig for workouts app."""
from django.apps import AppConfig
......
"""Mixins for the workouts application."""
class CreateListModelMixin(object):
"""Mixin that allows to create multiple objects from lists.
......
"""Contains the models for the workouts Django application.
Users log workouts (Workout), which contain instances (ExerciseInstance)
of various type of exercises (Exercise). The user can also upload files
(WorkoutFile) .
"""
import functools
import os
from dataclasses import dataclass
......@@ -18,10 +12,7 @@ from django.db import models
class OverwriteStorage(FileSystemStorage):
"""Filesystem storage for overwriting files.
Currently unused.
"""
"""Filesystem storage for overwriting files."""
def get_available_name(self, name, max_length=None):
"""https://djangosnippets.org/snippets/976/ Returns a filename that's
......
"""Contains custom parsers for serializers from the workouts Django app."""
import json
from rest_framework import parsers
......
"""Contains custom DRF permissions classes for the workouts app."""
from rest_framework import permissions
from workouts.models import Workout
......
"""Serializers for the workouts application."""
from rest_framework import serializers
from rest_framework.serializers import HyperlinkedRelatedField
......
"""Tests for the workouts application."""
from django.test import RequestFactory
from django.test import TestCase
......@@ -13,11 +12,9 @@ from workouts.permissions import IsReadOnly
from workouts.permissions import IsWorkoutPublic
# Create your tests here.
class PermissionTests(TestCase):
@classmethod
def setUpTestData(cls):
# Set up non-modified objects used by all test methods
User.objects.create(password="test123", username="test@gmail.com")
User.objects.create(password="testing1234", username="testing@gmail.com")
user = User.objects.get(id=1)
......@@ -56,7 +53,6 @@ class PermissionTests(TestCase):
)
def setUp(self):
# Setup run before every test method.
self.user1 = User.objects.get(id=1)
self.user2 = User.objects.get(id=2)
self.coach = User.objects.get(id=3)
......
"""Contains views for the workouts application.
These are mostly class-based views.
"""
from operator import attrgetter
from django.db.models import Q
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment