def setUp(self): # GIVEN organization self.org = mommy.make(Organization, email='[email protected], [email protected]') # AND I am logged in as expertA expertA = User.objects.create_user('expertA', '*****@*****.**', 'password') expertA.profile.is_expertA = True self.login('expertA', 'password') # AND server-side view that generates invite links self.sendmailview = SendMailView(request=self.requestfactory.get('')) # AND I am on "organizations" page self.get(reverse('exmo2010:manage_orgs', args=[self.org.monitoring.pk]))
class OrganizationsVerifyJavasciptInviteLinksTestCase(BaseSeleniumTestCase): # exmo2010:manage_orgs # Invite links generated in javascript should be equal to server-generated. def setUp(self): # GIVEN organization self.org = mommy.make(Organization, email='[email protected], [email protected]') # AND I am logged in as expertA expertA = User.objects.create_user('expertA', '*****@*****.**', 'password') expertA.profile.is_expertA = True self.login('expertA', 'password') # AND server-side view that generates invite links self.sendmailview = SendMailView(request=self.requestfactory.get('')) # AND I am on "organizations" page self.get(reverse('exmo2010:manage_orgs', args=[self.org.monitoring.pk])) def test_single_org_link_icon_click(self): # WHEN I click first organization link icon self.find('#org_row_%s a.org_invite_link' % self.org.pk).click() # THEN invite links modal window should become visible self.assertVisible('#invite_links_window') # AND each widget should have generated link equal to the link generated by the server for widget in self.findall('.invite_widgets tr'): if widget.is_displayed(): email = widget.find('input.email').get_attribute('value') javascript_generated_link = widget.find('input.invite_link').get_attribute('value') server_generated_link = self.sendmailview.replace_link('%link%', email, [self.org]) self.assertEqual(server_generated_link, javascript_generated_link)
class OrganizationsVerifyJavasciptInviteLinksTestCase(BaseSeleniumTestCase): # exmo2010:manage_orgs # Invite links generated in javascript should be equal to server-generated. def setUp(self): # GIVEN organization self.org = mommy.make(Organization, email='[email protected], [email protected]') # AND I am logged in as expertA expertA = User.objects.create_user('expertA', '*****@*****.**', 'password') expertA.profile.is_expertA = True self.login('expertA', 'password') # AND server-side view that generates invite links self.sendmailview = SendMailView(request=self.requestfactory.get('')) # AND I am on "organizations" page self.get(reverse('exmo2010:manage_orgs', args=[self.org.monitoring.pk])) def test_single_org_link_icon_click(self): # WHEN I click first organization link icon self.find('#org_row_%s a.org_invite_link' % self.org.pk).click() # THEN invite links modal window should become visible self.assertVisible('#invite_links_window') # AND each widget should have generated link equal to the link generated by the server for widget in self.findall('.invite_widgets tr'): if widget.is_displayed(): email = widget.find('input.email').get_attribute('value') javascript_generated_link = widget.find( 'input.invite_link').get_attribute('value') server_generated_link = self.sendmailview.replace_link( '%link%', email, [self.org]) self.assertEqual(server_generated_link, javascript_generated_link)