| Conditions | 8 |
| Total Lines | 109 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| 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 | |||
| 92 | def test_signup_tutor_flow(base_url, browser, outbox): |
||
| 93 | tutor_type = create_user_type(slug='tutor') |
||
| 94 | user = create_user_verify_login(base_url, browser, outbox) |
||
| 95 | |||
| 96 | browser.fill('login', user.email) |
||
| 97 | browser.fill('password', '123123') |
||
| 98 | browser.find_by_css('[type=submit]')[0].click() |
||
| 99 | |||
| 100 | # assert browser.is_text_present("My Profile") |
||
| 101 | poc_type = f.create_usertype(slug='poc', display_name='College POC') |
||
| 102 | user.profile.usertype.clear() |
||
| 103 | user.profile.usertype.add(tutor_type) |
||
| 104 | user.profile.usertype.add(poc_type) |
||
| 105 | user.profile.save() |
||
| 106 | user.save() |
||
| 107 | section1 = f.create_workshop_section(name='section1') |
||
| 108 | location1 = f.create_locaiton(name='location1') |
||
| 109 | state1 = f.create_state(name='state1') |
||
| 110 | |||
| 111 | # mobile number chechk |
||
| 112 | url = base_url + '/profile/' + user.username + '/edit' |
||
| 113 | browser.visit(url) |
||
| 114 | browser.fill('mobile', '') |
||
| 115 | browser.select('usertype', tutor_type.id) |
||
| 116 | browser.select('interested_sections', section1.id) |
||
| 117 | browser.select('location', location1.id) |
||
| 118 | browser.select('interested_states', state1.id) |
||
| 119 | browser.find_by_css('[type=submit]')[0].click() |
||
| 120 | assert browser.is_text_present('This field is required.') |
||
| 121 | |||
| 122 | # interested state check |
||
| 123 | browser.visit(url) |
||
| 124 | browser.fill('mobile', '1234567890') |
||
| 125 | browser.select('location', location1.id) |
||
| 126 | browser.select('interested_states', state1.id) |
||
| 127 | browser.find_by_css('[type=submit]')[0].click() |
||
| 128 | assert browser.is_text_present('This field is required.') |
||
| 129 | |||
| 130 | # location check |
||
| 131 | browser.visit(url) |
||
| 132 | browser.fill('mobile', '1234567890') |
||
| 133 | browser.select('interested_sections', section1.id) |
||
| 134 | browser.select('interested_states', state1.id) |
||
| 135 | browser.find_by_css('[type=submit]')[0].click() |
||
| 136 | assert browser.is_text_present('This field is required.') |
||
| 137 | |||
| 138 | # Github check |
||
| 139 | browser.visit(url) |
||
| 140 | browser.fill('mobile', '1234567890') |
||
| 141 | browser.select('interested_sections', section1.id) |
||
| 142 | browser.select('interested_states', state1.id) |
||
| 143 | browser.select('location', location1.id) |
||
| 144 | browser.find_by_css('[type=submit]')[0].click() |
||
| 145 | assert browser.is_text_present('Github or LinkedIn field is mandatory') |
||
| 146 | |||
| 147 | browser.visit(url) |
||
| 148 | browser.fill('mobile', '1234567890') |
||
| 149 | browser.select('interested_sections', section1.id) |
||
| 150 | browser.select('interested_states', state1.id) |
||
| 151 | browser.select('location', location1.id) |
||
| 152 | browser.fill('github', 'https://github.com') |
||
| 153 | browser.find_by_css('[type=submit]')[0].click() |
||
| 154 | |||
| 155 | assert browser.is_text_present( |
||
| 156 | 'Interested workshop level field is mandatory') |
||
| 157 | |||
| 158 | browser.visit(url) |
||
| 159 | browser.fill('mobile', '1234567890') |
||
| 160 | browser.select('interested_sections', section1.id) |
||
| 161 | browser.select('interested_states', state1.id) |
||
| 162 | browser.select('interested_level', 1) |
||
| 163 | browser.select('location', location1.id) |
||
| 164 | browser.fill('github', 'https://github.com') |
||
| 165 | browser.find_by_css('[type=submit]')[0].click() |
||
| 166 | assert browser.is_text_present('This field is required.') |
||
| 167 | |||
| 168 | browser.visit(url) |
||
| 169 | browser.fill('first_name', 'First Name') |
||
| 170 | browser.fill('last_name', 'Last Name') |
||
| 171 | browser.fill('mobile', '1234567890') |
||
| 172 | browser.select('interested_sections', section1.id) |
||
| 173 | browser.select('interested_states', state1.id) |
||
| 174 | browser.select('interested_level', 1) |
||
| 175 | browser.select('location', location1.id) |
||
| 176 | browser.fill('github', 'https://github.com') |
||
| 177 | browser.fill('occupation', 'occupation') |
||
| 178 | browser.fill('work_location', 'work_location') |
||
| 179 | browser.fill('work_experience', 1) |
||
| 180 | |||
| 181 | browser.find_by_css('[type=submit]')[0].click() |
||
| 182 | assert browser.is_text_present('Deactive Account') |
||
| 183 | |||
| 184 | org = f.create_organisation(location=location1) |
||
| 185 | org.user.add(user) |
||
| 186 | # section2 = f.create_workshop_section(name='section2') |
||
| 187 | |||
| 188 | w1 = f.create_workshop(requester=org, workshop_section=section1) |
||
| 189 | w1.presenter.add(user) |
||
| 190 | w2 = f.create_workshop(requester=org, workshop_section=section1) |
||
| 191 | w2.presenter.add(user) |
||
| 192 | w3 = f.create_workshop(requester=org, workshop_section=section1) |
||
| 193 | w3.presenter.add(user) |
||
| 194 | w4 = f.create_workshop(requester=org, workshop_section=section1) |
||
| 195 | w4.presenter.add(user) |
||
| 196 | w5 = f.create_workshop(requester=org, workshop_section=section1) |
||
| 197 | w5.presenter.add(user) |
||
| 198 | |||
| 199 | url = base_url + '/profile/' + user.username + '/' |
||
| 200 | browser.visit(url) |
||
| 201 | # assert browser.is_text_present('Deactive Account') |
||
| 202 |