generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from ita-social-projects/#188GetCategoryActivity
#188 get category activity
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from rest_framework.test import APITestCase, APIClient | ||
from profiles.models import Activity | ||
|
||
class TestActivityList(APITestCase): | ||
|
||
def setUp(self) -> None: | ||
self.transport_activity = Activity.objects.create(name="transport") | ||
self.sale_activity = Activity.objects.create(name="sale") | ||
self.production_activity = Activity.objects.create(name="production") | ||
self.education_activity = Activity.objects.create(name="education") | ||
|
||
def tearDown(self) -> None: | ||
objects_to_delete = Activity.objects.all() | ||
objects_to_delete.delete() | ||
|
||
def test_get_all_activities(self): | ||
response = self.client.get("/api/activity-list/") | ||
self.assertEqual(200, response.status_code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from rest_framework.test import APITestCase, APIClient | ||
from profiles.models import Category | ||
|
||
class TestCategoryList(APITestCase): | ||
|
||
def setUp(self) -> None: | ||
self.cheese_category = Category.objects.create(name='cheese') | ||
self.honey_category = Category.objects.create(name="honey") | ||
self.chocolate_category = Category.objects.create(name='chocolate') | ||
self.bacery_category = Category.objects.create(name="bacery") | ||
|
||
def tearDown(self) -> None: | ||
objects_to_delete = Category.objects.all() | ||
objects_to_delete.delete() | ||
|
||
def test_get_all_activities(self): | ||
response = self.client.get("/api/category-list/") | ||
self.assertEqual(200, response.status_code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters