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

Integration Tests For Campaign #910

Merged
merged 11 commits into from
Feb 12, 2024
Merged

Integration Tests For Campaign #910

merged 11 commits into from
Feb 12, 2024

Conversation

abdullai-t
Copy link
Contributor

@abdullai-t abdullai-t commented Feb 9, 2024

Summary / Highlights

This pull request includes the following changes:

  • Update the build version to 5.1.13 in the deployConfig.json, build.json, and api_version_dev.txt files to ensure version consistency across all files.

  • Implement role-based authorization for campaign management to restrict certain actions to authorized users only.

  • Add comprehensive tests for Campaign API endpoints to ensure proper functionality and prevent regressions.

Details (Give details about what this PR accomplishes, include any screenshots etc)

Testing Steps (Provide details on how your changes can be tested)

Requirements (place an x in each [ ])

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've tested my changes manually.
  • I've added unit tests to my PR.
Transparency (Project board)
  • I've given my PR a meaningful title.
  • I linked this PR to the relevant issue.
  • I moved the linked issue from the "Sprint backlog" to "In progress" when I started this.
  • I moved the linked issue to "QA Verification" now that it is ready to merge.

abdullai-t and others added 11 commits February 9, 2024 09:04
This commit adds role-based checks to ensure that only administrators or authorized users can perform certain actions in the campaign management module. These actions include creating and updating a campaign, managing campaign managers, and handling campaign technologies, communities, and testimonials. Unauthorized attempts are now handled by displaying a "Not authorized" error message. Some code clean-up and consistency improvements were made as well.
This commit introduces a substantial amount of tests for various Campaign-related API operations. This includes operations like creating, updating, and deleting campaigns, managing campaign managers and communities, handling campaign technologies, and associated testimonials and comments. All the tests take into account different user roles such as super admin, community admin, or an ordinary user.
The changes include correcting the DJANGO_ENV variable setting in the 'start' rule of the Makefile for proper local deployment. The 'create-default-template' command has been removed, as it appears to be unnecessary.
The redundant local environment check was removed from settings.py. This simplification eliminates a conditional expression and makes the code cleaner and easier to maintain.
Cleaned up and refactored parts of the campaign-related code, particularly in 'campaign.py'. Ensured the removal of unused endpoints and validators. Also added the '@admins_only' decorator to some functions to restrict access. Updated the corresponding test suite to match these changes.
These two files in the API services and API store directories were removed as they were not being used. This aims to keep the codebase clean and manageable. Regular audits should be conducted to eliminate unused codes.
Added a function to create a new Vendor in the common.py file for testing. Modified the technology handlers to restrict modifications and deletions to admins and the respective owners only, improving security and accountability. This includes tweaks in the create, update and delete operations in the TechnologyStore. Adjustments have also been made to ensure the webpage details are properly updated when changing vendor information.
This commit introduces CampaignService which handles various campaign-related operations. It provides methods for creating, deleting, updating campaigns as well as managing campaign managers and communities. The service also includes tasks associated with campaign technology like adding a follower or technology view.
@abdullai-t abdullai-t changed the title Campaign-tests Integration Tests For Campaign Feb 12, 2024
@archx3 archx3 merged commit 834670f into development Feb 12, 2024
1 check passed
@abdullai-t abdullai-t linked an issue Feb 15, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write Integration Tests for Campaign Endpoints
2 participants