-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Add test case for creating organization invoices #215
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there @SBMOYO,
Thank you for the PR, really appreciate it. Can the ENV_DIR directory be removed from the PR though please since it is committing ~40 files we don't need.
Thanks
5ca314d
to
e08b56a
Compare
…ncluded in future commits.
Hi @TreyWW |
Hey @SBMOYO, Did it definitely get removed, it still shows all files for me. Try |
how about now @TreyWW, Is it still there? |
That's better @SBMOYO, Thanks, i'll give it a review now. Appreciate it :) |
@TreyWW I noticed that you encountered an error while attempting to merge the branch. The issue seems to be related to invoice creation for an organization. Even when I explicitly set the organization value to a created team, the resulting invoice still has the organization variable set to None. Here’s the relevant snippet from the test output: self.assertEqual(invoice.organization, self.created_team)
# AssertionError: None != <Team: Team object (1)> To address this, I set the organization as follows: data["organization"] = self.created_team.pk Could you please investigate this further? It appears that the organization assignment is not functioning as expected during invoice creation. |
Oh right yeah, apologies for that. I'll look into this in about 20 mins. Thanks for pointing it out |
Hi again @SBMOYO, So the issue seemed to be with your login to team handler. The logged_in_as_team field never gets saved so the user isnt actually logged in. def login_to_team(self):
self.login_user()
self.log_in_user.logged_in_as_team = self.created_team
# needs to save afterwards --> self.log_in_user.save() Furthermore there's another bug,
this is due to |
@TreyWW Thanks for pointing out the issue with the login team handler. Regarding the other bug: AssertionError: 0 != 1 for self.assertEqual(len(invoices), 1) If I update the code I like you suggested I have a question, when a user creates an invoice as an individual the organisation variable is set to None. What value is the user variable set to when a user creates an invoice for an organisation, is it set to None just like what happens to organisation? |
Sorry completely missed your message. Yep you're correct, if it's saving as an org then organisation is set to team object and user is none. And if setting under individual then user is the User object and organisation is none |
Great, so that's where the problem was. I was testing if |
Hi @SBMOYO, |
Thanks for the PR @SBMOYO! Really appreciate it. |
Description
This pull request (PR) adds a new test case that covers scenarios related to invoice creation for organizations. It ensures that the process works correctly and checks if the organization variable is set to the team that created the invoice.
Motivation and Context
The motivation behind this change is to improve the accuracy of invoice creation within our system. By adding a specific test case and fixing the organization assignment, we ensure that invoices are associated correctly with the respective teams.
Dependencies
No specific dependencies are required for this change.
Checklist
What type of PR is this?
Added/updated tests?
Related PRs, Issues