def testRenderAddUsersWithError(self): """Test the user add form is rendered properly with an error.""" # Disabling the protected access check here intentionally so we can test a # private method. # pylint: disable=protected-access fake_error = 'foo bar happened causing baz' add_users_template = user._RenderAddUsersTemplate([], fake_error) self.assertTrue('An error occurred while' in add_users_template) self.assertTrue(fake_error in add_users_template)
def testRenderAddUsersWithUsers(self): """Test the user add form is rendered properly with users.""" # Disabling the protected access check here intentionally so we can test a # private method. # pylint: disable=protected-access add_users_template = user._RenderAddUsersTemplate(FAKE_USER_ARRAY) self.assertTrue('Add Selected Users' in add_users_template) self.assertTrue('xsrf' in add_users_template) self.assertTrue('An error occurred while' not in add_users_template)
def testRenderAddUsersWithNoUsers(self): """Test the user add form is rendered properly without users.""" # Disabling the protected access check here intentionally so we can test a # private method. # pylint: disable=protected-access add_users_template = user._RenderAddUsersTemplate([]) no_user_string = 'No users found. Try another query below.' self.assertTrue(no_user_string in add_users_template) self.assertTrue('xsrf' in add_users_template) self.assertTrue('An error occurred while' not in add_users_template)