Skip to content

Commit

Permalink
Merge pull request #120 from matorral-project/towards-mvp-2-c
Browse files Browse the repository at this point in the history
Fixed tests, disabled workspaces urls & remove not used app
  • Loading branch information
matagus authored Mar 5, 2024
2 parents be446bf + 040ead9 commit b154184
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 132 deletions.
6 changes: 6 additions & 0 deletions config/settings/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@
# ------------------------------------------------------------------------------
TEST_RUNNER = "django.test.runner.DiscoverRunner"

PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
]

CELERY_ALWAYS_EAGER = True

# Your local stuff: Below this line define 3rd party library settings
2 changes: 1 addition & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
path(r"<workspace>/workspaces/", include("matorral.workspaces.urls", namespace="workspaces")),
path(r"<workspace>/", include("matorral.stories.urls", namespace="stories")),
path(r"<workspace>/sprints/", include("matorral.sprints.urls", namespace="sprints")),
path(r"", workspace_index, name="workspace:index"),
path(r"", workspace_index, name="workspace:index"), # disabled for now, until we finish all the features
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.DEBUG:
Expand Down
File renamed without changes.
Empty file.
10 changes: 0 additions & 10 deletions matorral/authentication/models.py

This file was deleted.

Empty file.
12 changes: 0 additions & 12 deletions matorral/authentication/test/test_signals.py

This file was deleted.

1 change: 0 additions & 1 deletion matorral/authentication/urls.py

This file was deleted.

22 changes: 22 additions & 0 deletions matorral/stories/factories.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import factory

from factory import fuzzy

from matorral.stories.models import Story, StoryState


class StoryFactory(factory.django.DjangoModelFactory):
class Meta:
model = Story

title = factory.Faker("sentence", nb_words=4)
description = factory.Faker("text")
state = fuzzy.FuzzyChoice(StoryState.objects.all())
points = factory.Faker("random_int", min=0, max=8)

workspace = factory.SubFactory("matorral.workspaces.factories.WorkspaceFactory")
requester = factory.SubFactory("matorral.users.tests.factories.UserFactory")
assignee = factory.SubFactory("matorral.users.tests.factories.UserFactory")

created_at = factory.Faker("date_time_this_decade")
updated_at = factory.Faker("date_time_this_decade")
20 changes: 19 additions & 1 deletion matorral/stories/tests.py
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# Create your tests here.
from django.test import TestCase
from django.urls import reverse

from matorral.stories.factories import StoryFactory
from matorral.workspaces.factories import WorkspaceFactory


class StoryViewsTest(TestCase):
def setUp(self):
self.workspace = WorkspaceFactory.create()
self.story = StoryFactory.create(workspace=self.workspace)

def test_list(self):
response = self.client.get(reverse("stories:story-list", args=[self.workspace.slug]))
self.assertEqual(response.status_code, 302)

def test_detail(self):
response = self.client.get(self.story.get_absolute_url())
self.assertEqual(response.status_code, 302)
1 change: 1 addition & 0 deletions matorral/taskapp/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def ready(self):
# pickle the object when using Windows.
app.config_from_object("django.conf:settings")
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, force=True)
app.conf.task_always_eager = settings.CELERY_ALWAYS_EAGER


@app.task(bind=True)
Expand Down
44 changes: 0 additions & 44 deletions matorral/users/tests/test_admin.py

This file was deleted.

6 changes: 4 additions & 2 deletions matorral/users/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from test_plus.test import TestCase
from django.test import TestCase

from matorral.users.tests.factories import UserFactory


class TestUser(TestCase):

def setUp(self):
self.user = self.make_user()
self.user = UserFactory.create(username="testuser")

def test__str__(self):
self.assertEqual(self.user.__str__(), "testuser") # This is the default username for self.make_user()
Expand Down
52 changes: 0 additions & 52 deletions matorral/users/tests/test_views.py

This file was deleted.

11 changes: 11 additions & 0 deletions matorral/workspaces/factories.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import factory

from matorral.workspaces.models import Workspace


class WorkspaceFactory(factory.django.DjangoModelFactory):
class Meta:
model = Workspace

name = factory.Faker("name")
slug = factory.Faker("slug")
11 changes: 2 additions & 9 deletions matorral/workspaces/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.urls import reverse_lazy
from django.utils.decorators import method_decorator
from django.utils.text import slugify
Expand Down Expand Up @@ -192,11 +191,5 @@ def post(self, *args, **kwargs):

@login_required
def workspace_index(request):
workspace_list = request.user.workspace_set.order_by("name")

q = request.GET.get("q")

if q is not None:
workspace_list = workspace_list.filter(name__icontains=q)

return render(request, "workspaces/index.html", {"workspace_list": workspace_list, "title": "Workspaces"})
default_workspace = request.user.workspace_set.order_by("id").first()
return HttpResponseRedirect(reverse_lazy("stories:story-list", args=[default_workspace.slug]))
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ extra-dependencies = [
"django~={matrix:django}.0",
"django_coverage_plugin",
"django-debug-toolbar",
"factory-boy",
]

[[tool.hatch.envs.test.matrix]]
Expand Down

0 comments on commit b154184

Please sign in to comment.