Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edd 1893 tramos alameda #2

Merged
merged 11 commits into from
Apr 19, 2024
25 changes: 25 additions & 0 deletions .github/workflows/test_task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: UOCT - tests
on:
push:
branches:
- dev
- main
paths-ignore:
- 'README.md'
pull_request:
branches:
- dev
- main
paths-ignore:
- 'README.md'

jobs:
test-build:
runs-on: ubuntu-latest
steps:
- name: Repo checkout
uses: actions/checkout@v4.1.1

- name: Build and run tests
if: github.event_name == 'pull_request' || (github.event_name == 'push' && !contains(github.event.head_commit.message, 'Merge pull request'))
run: make test
36 changes: 23 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Windows
ifeq ($(OS),Window_NT)
TEST = docker compose -p uoct-backend-test -f docker\docker-compose.yml
COMPOSE_DEV = docker compose -p uoct-backend-dev -f docker\docker-compose.yml -f docker\docker-compose-dev.yml --env-file .env.frontend
COMPOSE_PROD = docker compose -p uoct-backend-prod -f docker\docker-compose.yml --env-file .env.frontend
TEST = docker compose -p uoct-backend-test -f docker\docker-compose.yml --profile test
COMPOSE_DEV = docker compose -p uoct-backend-dev -f docker\docker-compose.yml -f docker\docker-compose-dev.yml --env-file .env.frontend --profile dev
COMPOSE_PROD = docker compose -p uoct-backend-prod -f docker\docker-compose.yml --env-file .env.frontend --profile prod
MANAGE = python backend\manage.py
# Linux
else
TEST = docker compose -p uoct-backend-test -f docker/docker-compose.yml
COMPOSE_DEV = docker compose -p uoct-backend-dev -f docker/docker-compose.yml -f docker/docker-compose-dev.yml --env-file .env.frontend
COMPOSE_PROD = docker compose -p uoct-backend-prod -f docker/docker-compose.yml --env-file .env.frontend
TEST = docker compose -p uoct-backend-test -f docker/docker-compose.yml --profile test
COMPOSE_DEV = docker compose -p uoct-backend-dev -f docker/docker-compose.yml -f docker/docker-compose-dev.yml --env-file .env.frontend --profile dev
COMPOSE_PROD = docker compose -p uoct-backend-prod -f docker/docker-compose.yml --env-file .env.frontend --profile prod
MANAGE = python backend/manage.py
endif

Expand All @@ -17,13 +17,23 @@ migrate:
$(MANAGE) migrate

test:
$(TEST) --profile test build
$(TEST) --profile test up --abort-on-container-exit
$(TEST) build
$(TEST) up --abort-on-container-exit

dev_up:
$(COMPOSE_DEV) --profile dev build
$(COMPOSE_DEV) --profile dev up
test_down:
$(TEST) down

build:
$(COMPOSE_DEV) build

up:
$(COMPOSE_DEV) up

down:
$(COMPOSE_DEV) down

db:
$(COMPOSE_DEV) up db
prod_up:
@$(COMPOSE_PROD) --profile prod build
@$(COMPOSE_PROD) --profile prod up -d
@$(COMPOSE_PROD) build
@$(COMPOSE_PROD) up -d
Empty file.
17 changes: 17 additions & 0 deletions backend/backend/tests/baseTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.test import TestCase
from rest_framework.test import APIClient
from django.contrib.auth import get_user_model
from django.urls import reverse


class BaseTest(TestCase):

def setUp(self):
self.user = get_user_model().objects.create_user({
'username': "TestUser",
'password': "TestPassword"
})
self.client = APIClient()
login_token = self.client.get(reverse('login')).content
return
self.client.credentials(HTTP_AUTHORIZATION='Token {0}'.format(login_token))
3 changes: 2 additions & 1 deletion backend/backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('admin/', admin.site.urls),
path('gps/', include(('gps.urls', 'gps'), namespace='gps'))
path('api/gps/', include(('gps.urls', 'gps'), namespace='gps')),
path('api/geo/', include(('rest_api.urls', 'geo'), namespace='geo'))
]


Empty file added backend/config/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions backend/config/environment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from decouple import config

PROTO_URL = config('PROTO_URL')
6 changes: 6 additions & 0 deletions backend/config/paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os
from pathlib import Path

ROOT_PATH = Path(__file__).parent.parent
LOGS_PATH = Path(os.path.join(ROOT_PATH, "logs"))
TEST_PATH = Path("C:/Users/mnfar/Desktop/Memoria/Recursos/test_uoct")

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"place_id": 1363431, "licence": "Data \u00a9 OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright", "osm_type": "relation", "osm_id": 164609, "lat": "-33.4377756", "lon": "-70.6504502", "class": "boundary", "type": "administrative", "place_rank": 16, "importance": 0.659760745604439, "addresstype": "city", "name": "Santiago", "display_name": "Santiago, Provincia de Santiago, Santiago Metropolitan Region, Chile", "boundingbox": ["-33.4785698", "-33.4255933", "-70.6920527", "-70.6249963"], "geojson": {"type": "Polygon", "coordinates": [[[-70.6920527, -33.4444848], [-70.6906888, -33.4444137], [-70.6900833, -33.4443859], [-70.6899544, -33.44438], [-70.6893368, -33.4443516], [-70.6889484, -33.4443337], [-70.6884781, -33.4443121], [-70.6880386, -33.4442919], [-70.6874306, -33.444264], [-70.6867406, -33.4442323], [-70.6855872, -33.4441793], [-70.6843688, -33.4441177], [-70.6842386, -33.444111], [-70.684126, -33.4441037], [-70.6835051, -33.4440762], [-70.6827769, -33.4440393], [-70.6822198, -33.4440119], [-70.6816078, -33.4439815], [-70.6805822, -33.4439309], [-70.6804629, -33.4439236], [-70.6803189, -33.4439121], [-70.6795784, -33.4438552], [-70.6795529, -33.4443197], [-70.6794979, -33.4449413], [-70.67949, -33.4450308], [-70.6794859, -33.4450764], [-70.6794188, -33.445835], [-70.6793461, -33.4466564], [-70.6793267, -33.4468752], [-70.6793176, -33.4469836], [-70.679296, -33.4472421], [-70.6792416, -33.4478923], [-70.6791968, -33.4484042], [-70.6790484, -33.4500985], [-70.6790005, -33.450645], [-70.678994, -33.4507192], [-70.6789825, -33.4508241], [-70.6778718, -33.4505935], [-70.6778679, -33.450614], [-70.6778491, -33.4507109], [-70.6778383, -33.4508625], [-70.6778383, -33.450947], [-70.677843, -33.4510416], [-70.6778484, -33.4511367], [-70.6778685, -33.4513896], [-70.6779396, -33.4524084], [-70.67801, -33.4534786], [-70.6780827, -33.454539], [-70.6781207, -33.4550608], [-70.6781553, -33.4555379], [-70.6782331, -33.4567282], [-70.6783411, -33.4581446], [-70.6783917, -33.458856], [-70.6784858, -33.4602285], [-70.6785876, -33.4614007], [-70.6786678, -33.4624783], [-70.6787532, -33.463397], [-70.6787975, -33.4640094], [-70.6788541, -33.464957], [-70.6789722, -33.4666558], [-70.6789975, -33.4670576], [-70.6791285, -33.4691406], [-70.6791465, -33.4692967], [-70.6791552, -33.469361], [-70.6791653, -33.4694108], [-70.6791747, -33.469451], [-70.6791902, -33.4694896], [-70.6792324, -33.4695719], [-70.6792867, -33.4696675], [-70.6793779, -33.4698196], [-70.6797132, -33.4703202], [-70.6797769, -33.4704025], [-70.6798024, -33.4704316], [-70.6798229, -33.4704514], [-70.6798537, -33.4704729], [-70.6798661, -33.4704984], [-70.6798721, -33.4705255], [-70.6798722, -33.4705472], [-70.6798681, -33.4705686], [-70.6798573, -33.4705912], [-70.6798406, -33.4706111], [-70.67981, -33.4706397], [-70.6797747, -33.4706643], [-70.6791112, -33.4706686], [-70.6781055, -33.4706608], [-70.6775696, -33.4706566], [-70.6767983, -33.4706504], [-70.6765254, -33.4706482], [-70.6763993, -33.4706471], [-70.6755451, -33.4706403], [-70.6742444, -33.4706298], [-70.6739345, -33.4706273], [-70.6736164, -33.4706247], [-70.6729527, -33.4706201], [-70.6729308, -33.4719227], [-70.6729205, -33.4726961], [-70.6729135, -33.4732247], [-70.6729145, -33.4737425], [-70.6729151, -33.4737682], [-70.6729259, -33.4742328], [-70.6729333, -33.4745521], [-70.6729285, -33.4746747], [-70.6730222, -33.4746845], [-70.6731043, -33.475069], [-70.6732577, -33.4753382], [-70.6734823, -33.4755786], [-70.6737425, -33.4757935], [-70.6741636, -33.4759681], [-70.6745155, -33.4760858], [-70.6749072, -33.4761798], [-70.675864, -33.4762312], [-70.6764431, -33.4762298], [-70.6769177, -33.4762808], [-70.6772932, -33.4762719], [-70.6777331, -33.476245], [-70.6780442, -33.476245], [-70.678036, -33.476654], [-70.6785976, -33.4766211], [-70.6807164, -33.4766538], [-70.6808173, -33.478399], [-70.6716346, -33.4785698], [-70.6716712, -33.476164], [-70.6716037, -33.4761631], [-70.6713903, -33.4761602], [-70.6704869, -33.4763574], [-70.6697596, -33.4764196], [-70.6674997, -33.4763347], [-70.6662655, -33.4761834], [-70.665564, -33.4760889], [-70.6655484, -33.4761822], [-70.6648246, -33.4760028], [-70.6619339, -33.4759191], [-70.6614405, -33.4759317], [-70.6596253, -33.4760904], [-70.658445, -33.4761863], [-70.6549426, -33.4764708], [-70.6540339, -33.4765557], [-70.6499422, -33.4767071], [-70.6482452, -33.4767575], [-70.648253, -33.4765685], [-70.6464723, -33.4765622], [-70.6419393, -33.4763947], [-70.6403686, -33.4763634], [-70.6392099, -33.47612], [-70.6379653, -33.4756976], [-70.6348068, -33.474595], [-70.6321803, -33.47365], [-70.6319636, -33.4735704], [-70.6305238, -33.4730414], [-70.6287385, -33.4723827], [-70.6270219, -33.4716883], [-70.6266896, -33.4715382], [-70.6264812, -33.471409], [-70.6260778, -33.4710439], [-70.6257001, -33.4706072], [-70.6252881, -33.4700702], [-70.6249963, -33.4695976], [-70.6255628, -33.4692683], [-70.6258289, -33.469032], [-70.6259549, -33.4688254], [-70.6260665, -33.4685963], [-70.6261636, -33.4682587], [-70.6263953, -33.467285], [-70.626979, -33.4653088], [-70.6278545, -33.4623588], [-70.628566, -33.4599728], [-70.6287042, -33.4595089], [-70.6293136, -33.4573034], [-70.6303521, -33.4536656], [-70.6308142, -33.4521227], [-70.6308247, -33.4520877], [-70.6308476, -33.4520112], [-70.6309264, -33.4517501], [-70.630936, -33.4517187], [-70.6315052, -33.4498297], [-70.6315881, -33.4495335], [-70.6323863, -33.4469339], [-70.6328091, -33.4454969], [-70.6328387, -33.4453963], [-70.6328601, -33.4453227], [-70.6328678, -33.4452962], [-70.6334659, -33.443239], [-70.633588, -33.4428015], [-70.6342746, -33.4402804], [-70.6348529, -33.4384495], [-70.6350672, -33.4376824], [-70.6352106, -33.4370971], [-70.635324, -33.4368263], [-70.6353569, -33.4367322], [-70.635375, -33.4366584], [-70.6354297, -33.4364262], [-70.6354157, -33.4362626], [-70.6353964, -33.4356977], [-70.6354783, -33.4356882], [-70.635564, -33.4356805], [-70.6359526, -33.4355971], [-70.6367164, -33.4354152], [-70.6387247, -33.4349365], [-70.6388361, -33.4349094], [-70.6426827, -33.4340127], [-70.6429061, -33.4339666], [-70.6443015, -33.433645], [-70.6452749, -33.4334172], [-70.6466827, -33.4331067], [-70.6477323, -33.4328388], [-70.6478122, -33.4328072], [-70.6479418, -33.4327561], [-70.6480358, -33.4327244], [-70.6484352, -33.432633], [-70.6485545, -33.4326057], [-70.6486834, -33.4325844], [-70.6496154, -33.4323912], [-70.6499406, -33.4323227], [-70.6502529, -33.4322569], [-70.6504564, -33.4322132], [-70.6511307, -33.432059], [-70.6512312, -33.432036], [-70.6514741, -33.4319796], [-70.6515016, -33.4319732], [-70.6515858, -33.4319557], [-70.6517093, -33.431924], [-70.6519733, -33.4318603], [-70.652567, -33.4317141], [-70.6528489, -33.4316459], [-70.6529612, -33.4316179], [-70.653033, -33.4316003], [-70.6536291, -33.4314562], [-70.6562121, -33.4308938], [-70.6574562, -33.4305918], [-70.6594229, -33.4301145], [-70.6595966, -33.4300664], [-70.659742, -33.4300195], [-70.6598847, -33.4299672], [-70.6600244, -33.4299097], [-70.6602243, -33.4298195], [-70.6603061, -33.4297737], [-70.6603557, -33.4297452], [-70.6603801, -33.429729], [-70.6604062, -33.4297061], [-70.6604272, -33.4296863], [-70.6604556, -33.4296433], [-70.6604697, -33.4296019], [-70.6604824, -33.429542], [-70.6604932, -33.4294888], [-70.6605046, -33.4294099], [-70.6605011, -33.4293816], [-70.6604864, -33.4292645], [-70.6608532, -33.4290954], [-70.6613347, -33.4288984], [-70.6618537, -33.4287294], [-70.662488, -33.4285504], [-70.6631251, -33.4283903], [-70.6636441, -33.428256], [-70.6641886, -33.4281083], [-70.664784, -33.4279225], [-70.6670988, -33.4271121], [-70.6689066, -33.4264294], [-70.6702504, -33.4259324], [-70.6711301, -33.4255933], [-70.6711482, -33.425638], [-70.6712227, -33.42583], [-70.6712462, -33.4258934], [-70.6712911, -33.4260057], [-70.6713259, -33.4260969], [-70.6713501, -33.4261694], [-70.6714466, -33.4264817], [-70.6715727, -33.4268899], [-70.6716418, -33.427102], [-70.671684, -33.4272397], [-70.6717276, -33.4274048], [-70.671746, -33.4274985], [-70.6717649, -33.4275771], [-70.6717943, -33.427719], [-70.6718282, -33.42796], [-70.6718389, -33.4280438], [-70.6718267, -33.4281507], [-70.6718025, -33.4283311], [-70.6722616, -33.428182], [-70.673583, -33.4277456], [-70.673686, -33.4277134], [-70.6737467, -33.427693], [-70.6754684, -33.4271111], [-70.675783, -33.426991], [-70.6762534, -33.4268114], [-70.6765716, -33.4266726], [-70.6766381, -33.4266443], [-70.6767362, -33.4266241], [-70.6768379, -33.4266023], [-70.6769606, -33.4265883], [-70.6770762, -33.4265816], [-70.6771705, -33.426581], [-70.6773237, -33.4265922], [-70.6774239, -33.4266065], [-70.6775061, -33.4266205], [-70.6775989, -33.4266454], [-70.6776626, -33.4266692], [-70.6777615, -33.4267047], [-70.677889, -33.4267545], [-70.678069, -33.4268396], [-70.678985, -33.4272442], [-70.6791023, -33.4273007], [-70.6791995, -33.4273522], [-70.6793263, -33.4274132], [-70.6794631, -33.4274994], [-70.6795623, -33.4275732], [-70.6796555, -33.4276533], [-70.6797709, -33.4277518], [-70.6798828, -33.427857], [-70.6800035, -33.4279801], [-70.6801035, -33.4280937], [-70.6801792, -33.4281883], [-70.6802718, -33.4283187], [-70.6803495, -33.428453], [-70.6804213, -33.42858], [-70.6804843, -33.4287082], [-70.680542, -33.4288391], [-70.680605, -33.4289947], [-70.6806473, -33.4291492], [-70.6806768, -33.4292902], [-70.6806955, -33.4294027], [-70.6807123, -33.4295521], [-70.6807217, -33.4296842], [-70.6807237, -33.4297905], [-70.680723, -33.4299293], [-70.680717, -33.4300518], [-70.680695, -33.4303372], [-70.6806734, -33.4306165], [-70.6806614, -33.4308056], [-70.6806547, -33.4309948], [-70.6806495, -33.4311623], [-70.6806339, -33.4316654], [-70.6806322, -33.4317127], [-70.6806168, -33.4321465], [-70.6805746, -33.4328941], [-70.6806016, -33.4330202], [-70.6805353, -33.4331246], [-70.6805072, -33.4337654], [-70.6804376, -33.4345456], [-70.6803234, -33.4358403], [-70.6802204, -33.4369874], [-70.6801524, -33.4378038], [-70.6800777, -33.4383689], [-70.6800722, -33.4384427], [-70.681249, -33.4385249], [-70.6817228, -33.438558], [-70.6817269, -33.4385152], [-70.6817675, -33.4379757], [-70.6817666, -33.4379469], [-70.6819136, -33.4379563], [-70.6819536, -33.4374899], [-70.6819588, -33.437412], [-70.6818133, -33.4374031], [-70.6817897, -33.437389], [-70.6814709, -33.4373683], [-70.6814712, -33.4373255], [-70.6810848, -33.4372992], [-70.6810644, -33.4375162], [-70.6807902, -33.4374994], [-70.6808121, -33.4372661], [-70.6809232, -33.4372726], [-70.6810319, -33.4360408], [-70.6819124, -33.4361604], [-70.6826786, -33.4363189], [-70.683705, -33.4365228], [-70.6837385, -33.4375262], [-70.6842913, -33.4375636], [-70.6841402, -33.4387182], [-70.6865408, -33.4388915], [-70.6884525, -33.4390059], [-70.6894933, -33.4390803], [-70.690934, -33.4391728], [-70.6916101, -33.439229], [-70.6916638, -33.4392354], [-70.6918361, -33.4392648], [-70.6918073, -33.4393818], [-70.691787, -33.4394758], [-70.691754, -33.4396368], [-70.6917324, -33.4397992], [-70.6917257, -33.4398833], [-70.6917221, -33.4399676], [-70.6917211, -33.4401207], [-70.6917268, -33.4402737], [-70.6917939, -33.4411858], [-70.6920024, -33.4436684], [-70.6920319, -33.4440204], [-70.6920493, -33.4442934], [-70.6920527, -33.4444848]]]}}]
Loading