Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix syncing hubspot user #2219

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion courses/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ def handle_create_course_run_certificate(
lambda: generate_multiple_programs_certificate(user, programs)
)
call_command("configure_hubspot_properties")
sync_hubspot_user(instance)
sync_hubspot_user(instance.user)
9 changes: 6 additions & 3 deletions courses/signals_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_create_course_certificate(generate_program_cert_mock, mock_on_commit, m
Test that generate_multiple_programs_certificate is called when a course
certificate is created
"""
mocker.patch(
mocked_hubspot_contact_sync = mocker.patch(
"hubspot_sync.management.commands.configure_hubspot_properties._upsert_custom_properties",
)
user = UserFactory.create()
Expand All @@ -36,6 +36,7 @@ def test_create_course_certificate(generate_program_cert_mock, mock_on_commit, m
generate_program_cert_mock.assert_called_once_with(user, [program])
cert.save()
generate_program_cert_mock.assert_called_once_with(user, [program])
mocked_hubspot_contact_sync.assert_called_once()


@patch("courses.signals.transaction.on_commit", side_effect=lambda callback: callback())
Expand All @@ -46,7 +47,7 @@ def test_generate_program_certificate_if_not_live(
"""
Test that generate_multiple_programs_certificate is not called when a program is not live
"""
mocker.patch(
mocked_hubspot_contact_sync = mocker.patch(
"hubspot_sync.management.commands.configure_hubspot_properties._upsert_custom_properties",
)
user = UserFactory.create()
Expand All @@ -57,6 +58,7 @@ def test_generate_program_certificate_if_not_live(
generate_program_cert_mock.assert_not_called()
cert.save()
generate_program_cert_mock.assert_not_called()
mocked_hubspot_contact_sync.assert_called_once()


# pylint: disable=unused-argument
Expand All @@ -69,7 +71,7 @@ def test_generate_program_certificate_not_called(
Test that generate_multiple_programs_certificate is not called when a course
is not associated with program.
"""
mocker.patch(
mocked_hubspot_contact_sync = mocker.patch(
"hubspot_sync.management.commands.configure_hubspot_properties._upsert_custom_properties",
)
user = UserFactory.create()
Expand All @@ -78,3 +80,4 @@ def test_generate_program_certificate_not_called(
cert = CourseRunCertificateFactory.create(user=user, course_run=course_run)
cert.save()
generate_program_cert_mock.assert_not_called()
mocked_hubspot_contact_sync.assert_called_once()
Loading