-
Notifications
You must be signed in to change notification settings - Fork 1
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 #11 from arthur-schnitzler/main
Updates
- Loading branch information
Showing
7 changed files
with
160 additions
and
47 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,51 @@ | ||
# from django.test import TestCase | ||
from django.apps import apps | ||
from django.contrib.auth.models import User | ||
from django.test import Client, TestCase | ||
from django.urls import reverse | ||
|
||
# Create your tests here. | ||
from apis_core.apis_entities.models import Person, Place | ||
from archemd.arche_md_utils import ArcheMd | ||
from normdata.utils import import_from_normdata | ||
|
||
client = Client() | ||
USER = {"username": "testuser", "password": "somepassword"} | ||
BAHR = {"name": "Bahr", "first_name": "Hermann", "start_date_written": "1900"} | ||
|
||
ENTITY_TYPES = ["person", "place", "event", "work", "institution"] | ||
|
||
MODELS = list(apps.all_models["apis_entities"].values()) | ||
|
||
URIS = [ | ||
("https://www.geonames.org/2772400/linz.html", "place"), | ||
("https://www.wikidata.org/wiki/Q100965214", "person"), | ||
("http://lobid.org/gnd/1028192029", "person"), | ||
] | ||
|
||
|
||
class ArcheMedTestCase(TestCase): | ||
def setUp(self): | ||
User.objects.create_user(**USER) | ||
Person.objects.create(**BAHR) | ||
for x in URIS: | ||
import_from_normdata(x[0], x[1]) | ||
|
||
def test_01_archemd(self): | ||
item = Person.objects.last() | ||
arche_md = ArcheMd(item.id) | ||
g = arche_md.return_graph() | ||
self.assertTrue(g) | ||
|
||
def test_02_archemd_view(self): | ||
for item in Person.objects.all(): | ||
url = reverse("archemd:arche", kwargs={"pk": item.id}) | ||
response = client.get(url) | ||
self.assertTrue(response.status_code, 200) | ||
for item in Place.objects.all(): | ||
url = reverse("archemd:arche", kwargs={"pk": item.id}) | ||
response = client.get(url) | ||
self.assertTrue(response.status_code, 200) | ||
|
||
def test_03_archemd_doesnotexist(self): | ||
url = reverse("archemd:arche", kwargs={"pk": 99999}) | ||
response = client.get(url) | ||
self.assertTrue(response.status_code, 404) |
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
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