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>
28 lines
840 B
Python
28 lines
840 B
Python
import pytest
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_plugin_manifest(api_client):
|
|
response = api_client.get('/api/v1/plugins/')
|
|
assert response.status_code == 200
|
|
ids = [p['id'] for p in response.data]
|
|
assert 'tags' in ids
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_tags_crud(api_client, sample_contact):
|
|
create = api_client.post(
|
|
'/api/v1/plugins/tags/contact-tags/',
|
|
{'contact': sample_contact.id, 'label': 'коллеги'},
|
|
format='json',
|
|
)
|
|
assert create.status_code == 201
|
|
tag_id = create.data['id']
|
|
|
|
listing = api_client.get(f'/api/v1/plugins/tags/contact-tags/?contact_id={sample_contact.id}')
|
|
assert listing.status_code == 200
|
|
assert listing.data['count'] == 1
|
|
|
|
delete = api_client.delete(f'/api/v1/plugins/tags/contact-tags/{tag_id}/')
|
|
assert delete.status_code == 204
|