Split graph/import/meta into Django apps, add API v1 with OpenAPI and pytest, and introduce plugin registry with the tags reference plugin on both FE and BE. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
806 B
Python
25 lines
806 B
Python
import pytest
|
|
from django.urls import reverse
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_contacts_list(api_client, sample_contact):
|
|
response = api_client.get('/api/v1/contacts/')
|
|
assert response.status_code == 200
|
|
assert response.data['count'] == 1
|
|
assert response.data['results'][0]['name'] == 'Иван Иванов'
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_contact_create(api_client):
|
|
response = api_client.post('/api/v1/contacts/', {'name': 'Новый контакт'}, format='json')
|
|
assert response.status_code == 201
|
|
assert response.data['name'] == 'Новый контакт'
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_relations_list(api_client, sample_relation):
|
|
response = api_client.get('/api/v1/relations/')
|
|
assert response.status_code == 200
|
|
assert response.data['count'] == 1
|