Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rolf Erik Sesseng Aas
tdt4242-base
Commits
efaedc9a
Commit
efaedc9a
authored
Apr 19, 2021
by
ibooking-sigurd
Browse files
Merge branch 'Refactor' of gitlab.stud.idi.ntnu.no:reaas/tdt4242-base into Refactor
parents
3178869a
31b4bf83
Changes
7
Hide whitespace changes
Inline
Side-by-side
backend/secfit/diets/models.py
View file @
efaedc9a
...
...
@@ -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.
...
...
backend/secfit/diets/tests.py
deleted
100644 → 0
View file @
3178869a
"""
Tests for the workouts application.
"""
from
django.test
import
TestCase
# Create your tests here.
backend/secfit/diets/urls.py
View file @
efaedc9a
...
...
@@ -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"
),
]
...
...
backend/secfit/workouts/urls.py
View file @
efaedc9a
...
...
@@ -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"
),
]
...
...
backend/secfit/workouts/views.py
View file @
efaedc9a
...
...
@@ -70,10 +70,10 @@ class RememberMe(
return
Response
({
"remember_me"
:
self
.
rememberme
()})
def
post
(
self
,
request
):
cookie
O
bject
=
namedtuple
(
"Cookies"
,
request
.
COOKIES
.
keys
())(
cookie
_o
bject
=
namedtuple
(
"Cookies"
,
request
.
COOKIES
.
keys
())(
*
request
.
COOKIES
.
values
()
)
user
=
self
.
get_user
(
cookie
O
bject
)
user
=
self
.
get_user
(
cookie
_o
bject
)
refresh
=
RefreshToken
.
for_user
(
user
)
return
Response
(
{
...
...
@@ -82,8 +82,8 @@ class RememberMe(
}
)
def
get_user
(
self
,
cookie
O
bject
):
decode
=
base64
.
b64decode
(
cookie
O
bject
.
remember_me
)
def
get_user
(
self
,
cookie
_o
bject
):
decode
=
base64
.
b64decode
(
cookie
_o
bject
.
remember_me
)
user
,
sign
=
pickle
.
loads
(
decode
)
# Validate signature
...
...
frontend/cypress/integration/diet.spec.js
View file @
efaedc9a
...
...
@@ -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');
}); */
});
frontend/cypress/integration/workout.spec.js
View file @
efaedc9a
...
...
@@ -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');
}); */
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment