Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Tests for Job app #703

Merged
merged 1 commit into from
Jun 14, 2018
Merged

Conversation

Monal5031
Copy link
Contributor

Description

Tested Job app

  • Uncommented and corrected the commented tests
  • Move tests from automated testing repo
  • Write my own tests

Fixes #686

Type of Change:

Delete irrelevant options.

  • Code
  • Quality Assurance

Code/Quality Assurance Only

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

To verify that tests are non-breaking change in job app use:

python manage.py test job -v 2

and to overall project use:

python manage.py test

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • [x]I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged

Code/Quality Assurance Only

  • My changes generate no new warnings
  • My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been published in downstream modules

@Monal5031 Monal5031 added Type: Testing UI Tests, Integration Tests, Travis CI, etc. Program: GSOC Related to work completed during the Google Summer of Code Program. category: testing labels May 31, 2018
@anitab-org anitab-org deleted a comment May 31, 2018
@Monal5031 Monal5031 force-pushed the testing-job branch 4 times, most recently from 331a013 to 23c179e Compare June 2, 2018 13:14
@anitab-org anitab-org deleted a comment Jun 2, 2018
@Monal5031 Monal5031 force-pushed the testing-job branch 2 times, most recently from 5a71384 to 8775749 Compare June 5, 2018 15:19
['event', '2017-06-15', '2017-06-17'])
created_job = create_job_with_details(
['job', '2017-06-15', '2017-06-18', '', created_event])
pass
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try logging out for every test otherwise logout 1 time in class tear down.

Copy link
Contributor Author

@Monal5031 Monal5031 Jun 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naman1901 @pavankm I have a doubt regarding this.
If we logout only once i.e. in tearDownClass then build time won't be affected but if we logout each time i.e. in tearDown the build time will increase since it will logout for each test.

On the other hand the if we logout once that is less correct than each time, since each test is considered independent of the other and should end their session at end of test.

Need your views on which approach to go with.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have empirical data on how big a difference it makes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm not really but I did notice ~5 minutes minimum increase in boot time although the bu8ld time doesn't really increase by more than ~1 minute

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we should follow the correct approach even if it takes more time. Waiting for @pavankm to present his views.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log out every session

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think the same.

Copy link
Contributor Author

@Monal5031 Monal5031 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some changes.

job_details_page.click_link(job_details_page.jobs_tab)
self.assertEqual(job_details_page.remove_i18n(self.driver.current_url),
self.live_server_url + job_details_page.job_list_page)
self.assertEqual(job_details_page.get_message_context(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a variable inside JobDetailsPage itself (multiple uses might be possible.)

job_details_page.click_link(job_details_page.create_job_tab)
self.assertEqual(job_details_page.remove_i18n(self.driver.current_url),
self.live_server_url + job_details_page.create_job_page)
self.assertEqual(job_details_page.get_message_context(), 'Please add events to associate with jobs first.')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

job_details_page.fill_job_form(job_start_after_end)

# Check error.
self.assertEqual(job_details_page.get_job_start_date_error(), 'Start date must be before the end date')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

self.assertEqual(str(job_in_db.end_date), job[2])
self.assertEqual(job_in_db.description, job[3])

# Checks are missing from model class
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raise issue after confirmation in tomorrow's meeting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workaround found:
model validation checks aren't performed until a full_clean is called explicitly from code/command-line, Forms perform full_clean on submit thats why the error messages are shown. Thus model.save() will save the instance unless there not-null constraint is broken.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the confusion here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its resolved, by mistake I wrote workaround found instead should be Solution found

def get_message_context(self):
return self.events_page.get_message_context()

@staticmethod
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method can be part of BasePage will be needed by all pages.

Copy link
Contributor

@naman1901 naman1901 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll approve once there is clarity on the multiple login issue

@prachi1210
Copy link
Contributor

Review awaited from Anjali, Update and finalise PR and ping me on Slack @Monal5031

@Monal5031 Monal5031 force-pushed the testing-job branch 2 times, most recently from a718e68 to e55486d Compare June 10, 2018 01:58
@anitab-org anitab-org deleted a comment Jun 10, 2018
Copy link
Contributor

@anjali-dhanuka anjali-dhanuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

['event', '2017-06-15', '2017-06-17'])
created_job = create_job_with_details(
['job', '2017-06-15', '2017-06-18', '', created_event])
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think the same.

@anitab-org anitab-org deleted a comment Jun 14, 2018
@anitab-org anitab-org deleted a comment Jun 14, 2018
@prachi1210 prachi1210 merged commit c505bd0 into anitab-org:gsoc18-infra Jun 14, 2018
@Monal5031 Monal5031 deleted the testing-job branch June 14, 2018 13:34
anjali-dhanuka referenced this pull request in anjali-dhanuka/vms Jul 2, 2018
anjali-dhanuka referenced this pull request in anjali-dhanuka/vms Jul 2, 2018
anjali-dhanuka referenced this pull request in anjali-dhanuka/vms Jul 3, 2018
anjali-dhanuka referenced this pull request in anjali-dhanuka/vms Jul 3, 2018
anjali-dhanuka referenced this pull request in anjali-dhanuka/vms Jul 4, 2018
anjali-dhanuka referenced this pull request in anjali-dhanuka/vms Jul 6, 2018
anjali-dhanuka referenced this pull request in anjali-dhanuka/vms Jul 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Program: GSOC Related to work completed during the Google Summer of Code Program. Type: Testing UI Tests, Integration Tests, Travis CI, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants