Commit efaedc9a authored by ibooking-sigurd's avatar ibooking-sigurd
Browse files

Merge branch 'Refactor' of gitlab.stud.idi.ntnu.no:reaas/tdt4242-base into Refactor

parents 3178869a 31b4bf83
......@@ -134,19 +134,6 @@ class DietInstance(models.Model):
)
def diet_directory_path(instance, filename):
"""Return path for which diet files should be uploaded on the web server
Args:
instance (DietFile): DietFile instance
filename (str): Name of the file
Returns:
str: Path where diet file is stored
"""
return f"diets/{instance.instance.diet.id}/{filename}"
class DietFile(models.Model):
"""Django model for file associated with a diet. Basically a wrapper.
......
"""
Tests for the workouts application.
"""
from django.test import TestCase
# Create your tests here.
......@@ -5,9 +5,7 @@ from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
)
from rest_framework.urlpatterns import format_suffix_patterns
# This is a bit messy and will need to change
urlpatterns = format_suffix_patterns(
[
path("", views.api_root),
......@@ -56,7 +54,8 @@ urlpatterns = format_suffix_patterns(
path("", include("users.urls")),
path("", include("comments.urls")),
path("api/auth/", include("rest_framework.urls")),
path("api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
path("api/token/", TokenObtainPairView.as_view(),
name="token_obtain_pair"),
path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
path("api/remember_me/", views.RememberMe.as_view(), name="remember_me"),
]
......
......@@ -6,7 +6,6 @@ from rest_framework_simplejwt.views import (
TokenRefreshView,
)
# This is a bit messy and will need to change
urlpatterns = format_suffix_patterns(
[
path("", views.api_root),
......@@ -45,7 +44,8 @@ urlpatterns = format_suffix_patterns(
path("", include("users.urls")),
path("", include("comments.urls")),
path("api/auth/", include("rest_framework.urls")),
path("api/token/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
path("api/token/", TokenObtainPairView.as_view(),
name="token_obtain_pair"),
path("api/token/refresh/", TokenRefreshView.as_view(), name="token_refresh"),
path("api/remember_me/", views.RememberMe.as_view(), name="remember_me"),
]
......
......@@ -70,10 +70,10 @@ class RememberMe(
return Response({"remember_me": self.rememberme()})
def post(self, request):
cookieObject = namedtuple("Cookies", request.COOKIES.keys())(
cookie_object = namedtuple("Cookies", request.COOKIES.keys())(
*request.COOKIES.values()
)
user = self.get_user(cookieObject)
user = self.get_user(cookie_object)
refresh = RefreshToken.for_user(user)
return Response(
{
......@@ -82,8 +82,8 @@ class RememberMe(
}
)
def get_user(self, cookieObject):
decode = base64.b64decode(cookieObject.remember_me)
def get_user(self, cookie_object):
decode = base64.b64decode(cookie_object.remember_me)
user, sign = pickle.loads(decode)
# Validate signature
......
......@@ -146,24 +146,4 @@ describe('tests diets page', () => {
cy.get('.alert')
.should('be.visible');
});
/* it('alert should be visible if exercise has no data', () => {
cy.get('#inputName')
.type(generateStringWithLengthX(10));
cy.get('#inputDateTime')
.type('2021-03-11T10:00')
cy.get('#inputNotes')
.type(generateStringWithLengthX(10));
cy.get('[name="type"]')
.select(cy.get('[name="type"]').first().invoke('val'));
cy.get('#btn-ok-diet')
.click();
cy.get('.alert')
.should('be.visible');
}); */
});
......@@ -146,24 +146,4 @@ describe('boundary tests workout page', () => {
cy.get('.alert')
.should('be.visible');
});
/* it('alert should be visible if exercise has no data', () => {
cy.get('#inputName')
.type(generateStringWithLengthX(10));
cy.get('#inputDateTime')
.type('2021-03-11T10:00')
cy.get('#inputNotes')
.type(generateStringWithLengthX(10));
cy.get('[name="type"]')
.select(cy.get('[name="type"]').first().invoke('val'));
cy.get('#btn-ok-workout')
.click();
cy.get('.alert')
.should('be.visible');
}); */
});
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