Skip to content

Commit

Permalink
Merge pull request #1 from Fer-Bar/feat-add-security-to-views
Browse files Browse the repository at this point in the history
Added django workflow for CI
  • Loading branch information
enrker authored Feb 15, 2024
2 parents 3b94e9b + b691b3c commit 7d3ed6f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Django CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python -
- name: Install Dependencies
run: |
poetry install
- name: Run Tests
run: |
poetry run python manage.py test
23 changes: 0 additions & 23 deletions .github/workflows/pylint.yml

This file was deleted.

1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Dockerfile
FROM python:3.10-slim

ENV PYTHONUNBUFFERED 1
Expand Down
1 change: 0 additions & 1 deletion albercan_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"rest_framework",
"people",
"pet",
"structure"
Expand Down
9 changes: 9 additions & 0 deletions pet/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.test import TestCase

from pet.models import Pet


class TestPet(TestCase):
def test_create_pet_with_valid_instance(self):
pet = Pet.objects.create(name="Peter")
self.assertIsInstance(pet, Pet)
2 changes: 2 additions & 0 deletions pet/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.shortcuts import render
from django.views.decorators.http import require_http_methods


@require_http_methods(["GET"])
def main_page(request):
return render(request, 'pet/main_page.html')

0 comments on commit 7d3ed6f

Please sign in to comment.