Skip to content

Commit

Permalink
refactor: squash migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzawaleed01 committed Jan 30, 2024
1 parent c1109b0 commit d5bd99d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 38 deletions.
2 changes: 1 addition & 1 deletion integrated_channels/cornerstone/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from rest_framework.authentication import SessionAuthentication
from rest_framework.response import Response

from django.apps import apps
from django.utils.http import parse_http_date_safe

from django.apps import apps
from enterprise.api.throttles import ServiceUserThrottle
from enterprise.utils import get_enterprise_customer, get_enterprise_worker_user, get_oauth2authentication_class
from integrated_channels.cornerstone.models import CornerstoneEnterpriseCustomerConfiguration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.22 on 2024-01-25 09:25

from django.db import migrations
from django.db import migrations, models


class Migration(migrations.Migration):
Expand All @@ -14,4 +14,23 @@ class Migration(migrations.Migration):
name='integratedchannelapirequestlogs',
options={'verbose_name_plural': 'Integrated channels API request logs'},
),
migrations.RemoveField(
model_name='integratedchannelapirequestlogs',
name='api_record',
),
migrations.AddField(
model_name='integratedchannelapirequestlogs',
name='response_body',
field=models.TextField(blank=True, help_text='API call response body', null=True),
),
migrations.AddField(
model_name='integratedchannelapirequestlogs',
name='status_code',
field=models.PositiveIntegerField(blank=True, help_text='API call response HTTP status code', null=True),
),
migrations.AlterField(
model_name='integratedchannelapirequestlogs',
name='time_taken',
field=models.FloatField(),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('integrated_channel', '0032_auto_20240125_0936'),
('integrated_channel', '0031_alter_integratedchannelapirequestlogs_options'),
]

operations = [
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion integrated_channels/integrated_channel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,6 @@ def __repr__(self):
"""
return self.__str__()


@classmethod
def store_api_call(
cls,
Expand Down
11 changes: 9 additions & 2 deletions tests/test_integrated_channels/test_cornerstone/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
import pytest
import responses

from django.apps import apps

from integrated_channels.cornerstone.client import CornerstoneAPIClient
from test_utils import factories

IntegratedChannelAPIRequestLogs = apps.get_model(
"integrated_channel", "IntegratedChannelAPIRequestLogs"
)


@pytest.mark.django_db
class TestCornerstoneApiClient(unittest.TestCase):
Expand All @@ -26,7 +32,7 @@ def setUp(self):
)

@responses.activate
def test_create_course_completion(self):
def test_create_course_completion_stores_api_record(self):
"""
``create_course_completion`` should use the appropriate URLs for transmission.
"""
Expand All @@ -47,9 +53,10 @@ def test_create_course_completion(self):
json="{}",
status=200,
)
assert IntegratedChannelAPIRequestLogs.objects.count() == 0
output = cornerstone_api_client.create_course_completion(
"test-learner@example.com", json.dumps(payload)
)

assert IntegratedChannelAPIRequestLogs.objects.count() == 1
assert len(responses.calls) == 1
assert output == (200, '"{}"')

0 comments on commit d5bd99d

Please sign in to comment.