50 lines
2.2 KiB
Python
50 lines
2.2 KiB
Python
"""
|
|
Integration tests for Billing module endpoints
|
|
Tests credit balance, usage, transactions return unified format
|
|
"""
|
|
from rest_framework import status
|
|
from igny8_core.api.tests.test_integration_base import IntegrationTestBase
|
|
|
|
|
|
class BillingIntegrationTestCase(IntegrationTestBase):
|
|
"""Integration tests for Billing module"""
|
|
|
|
def test_credit_balance_returns_unified_format(self):
|
|
"""Test GET /api/v1/billing/credits/balance/balance/ returns unified format"""
|
|
response = self.client.get('/api/v1/billing/credits/balance/balance/')
|
|
|
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
|
self.assert_unified_response_format(response, expected_success=True)
|
|
self.assertIn('data', response.data)
|
|
|
|
def test_credit_usage_returns_unified_format(self):
|
|
"""Test GET /api/v1/billing/credits/usage/ returns unified format"""
|
|
response = self.client.get('/api/v1/billing/credits/usage/')
|
|
|
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
|
self.assert_paginated_response(response)
|
|
|
|
def test_usage_summary_returns_unified_format(self):
|
|
"""Test GET /api/v1/billing/credits/usage/summary/ returns unified format"""
|
|
response = self.client.get('/api/v1/billing/credits/usage/summary/')
|
|
|
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
|
self.assert_unified_response_format(response, expected_success=True)
|
|
self.assertIn('data', response.data)
|
|
|
|
def test_usage_limits_returns_unified_format(self):
|
|
"""Test GET /api/v1/billing/credits/usage/limits/ returns unified format"""
|
|
response = self.client.get('/api/v1/billing/credits/usage/limits/')
|
|
|
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
|
self.assert_unified_response_format(response, expected_success=True)
|
|
self.assertIn('data', response.data)
|
|
|
|
def test_transactions_returns_unified_format(self):
|
|
"""Test GET /api/v1/billing/credits/transactions/ returns unified format"""
|
|
response = self.client.get('/api/v1/billing/credits/transactions/')
|
|
|
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
|
self.assert_paginated_response(response)
|
|
|