| Conditions | 7 |
| Total Lines | 75 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | |||
| 15 | def test_signup_college_poc_flow(base_url, browser, outbox): |
||
| 16 | tutor_type = create_user_type(slug='tutor') |
||
| 17 | print(tutor_type) |
||
| 18 | user = create_user_verify_login(base_url, browser, outbox) |
||
| 19 | browser.fill('login', user.email) |
||
| 20 | browser.fill('password', '123123') |
||
| 21 | browser.find_by_css('[type=submit]')[0].click() |
||
| 22 | # assert browser.is_text_present("My Profile") |
||
| 23 | |||
| 24 | poc_type = f.create_usertype(slug='poc', display_name='College POC') |
||
| 25 | user.profile.usertype.clear() |
||
| 26 | user.profile.usertype.add(poc_type) |
||
| 27 | user.profile.save() |
||
| 28 | user.save() |
||
| 29 | section1 = f.create_workshop_section(name='section1') |
||
| 30 | |||
| 31 | location1 = f.create_locaiton(name='location1') |
||
| 32 | state1 = f.create_state(name='state1') |
||
| 33 | |||
| 34 | # mobile number chechk |
||
| 35 | url = base_url + '/profile/' + user.username + '/edit/' |
||
| 36 | browser.visit(url) |
||
| 37 | browser.fill('mobile', '') |
||
| 38 | browser.select('interested_sections', section1.id) |
||
| 39 | browser.select('location', location1.id) |
||
| 40 | browser.select('interested_states', state1.id) |
||
| 41 | browser.find_by_css('[type=submit]')[0].click() |
||
| 42 | assert browser.is_text_present('This field is required.') |
||
| 43 | |||
| 44 | # interested state check |
||
| 45 | browser.fill('mobile', '1234567890') |
||
| 46 | browser.select('location', location1.id) |
||
| 47 | browser.select('interested_states', state1.id) |
||
| 48 | browser.find_by_css('[type=submit]')[0].click() |
||
| 49 | assert browser.is_text_present('This field is required.') |
||
| 50 | |||
| 51 | # location check |
||
| 52 | browser.fill('mobile', '1234567890') |
||
| 53 | browser.select('interested_sections', section1.id) |
||
| 54 | browser.select('interested_states', state1.id) |
||
| 55 | browser.find_by_css('[type=submit]')[0].click() |
||
| 56 | assert browser.is_text_present('This field is required.') |
||
| 57 | |||
| 58 | # Use first name and last name |
||
| 59 | browser.fill('mobile', '1234567890') |
||
| 60 | browser.select('interested_sections', section1.id) |
||
| 61 | browser.select('interested_states', state1.id) |
||
| 62 | browser.select('location', location1.id) |
||
| 63 | browser.find_by_css('[type=submit]')[0].click() |
||
| 64 | assert browser.is_text_present('This field is required.') |
||
| 65 | |||
| 66 | # occupation is required |
||
| 67 | browser.fill('first_name', 'First Name') |
||
| 68 | browser.fill('last_name', 'Last Name') |
||
| 69 | browser.fill('mobile', '1234567890') |
||
| 70 | browser.select('interested_sections', section1.id) |
||
| 71 | browser.select('interested_states', state1.id) |
||
| 72 | browser.select('location', location1.id) |
||
| 73 | browser.find_by_css('[type=submit]')[0].click() |
||
| 74 | assert browser.is_text_present('This field is required.') |
||
| 75 | |||
| 76 | # Sucess case |
||
| 77 | browser.visit(url) |
||
| 78 | browser.fill('first_name', 'First Name') |
||
| 79 | browser.fill('last_name', 'Last Name') |
||
| 80 | browser.fill('mobile', '1234567890') |
||
| 81 | browser.fill('occupation', 'occupation') |
||
| 82 | browser.fill('work_location', 'work_location') |
||
| 83 | browser.fill('work_experience', 1) |
||
| 84 | browser.select('interested_sections', section1.id) |
||
| 85 | browser.select('interested_states', state1.id) |
||
| 86 | browser.select('location', location1.id) |
||
| 87 | browser.find_by_css('[type=submit]')[0].click() |
||
| 88 | |||
| 89 | assert browser.is_text_present('Deactive Account') |
||
| 90 | |||
| 202 |