def test_preview_ccg_bookmark(self, tmpfile, subprocess, finder): from test_bookmark_utils import _makeContext from django.conf import settings context = _makeContext( declines=[{ 'measure': Measure(id='foo'), 'from': 30, 'to': 10 }], interesting=[Measure(id='bar')], most_changing_interesting=[{ 'measure': Measure(id='baz'), 'from': 30, 'to': 10 }], ) test_img_path = (settings.SITE_ROOT + '/frontend/tests/fixtures/' 'alert-email-image.png') finder.return_value.context_for_org_email.return_value = context tmpfile.return_value.__enter__.return_value.name = test_img_path url = reverse('preview-ccg-bookmark', kwargs={'code': PCT.objects.first().pk}) response = self.client.post(url) self.assertContains(response, "this CCG") self.assertContains( response, "we found that this CCG was in the top or bottom 10%") with open(test_img_path, 'rb') as expected: self.assertContains(response, base64.b64encode(expected.read()))
def test_preview_practice_bookmark(self, finder): from test_bookmark_utils import _makeContext context = _makeContext() finder.return_value.context_for_org_email.return_value = context url = reverse('preview-practice-bookmark', kwargs={'code': Practice.objects.first().pk}) response = self.client.post(url) self.assertContains(response, "about this practice")
def test_preview_practice_bookmark(self, finder): from test_bookmark_utils import _makeContext context = _makeContext() finder.return_value.context_for_org_email.return_value = context url = reverse('preview-practice-bookmark', kwargs={'code': Practice.objects.first().pk}) self.client.force_login(User.objects.get(username='******')) response = self.client.get(url) self.assertContains( response, "about this practice")
def test_preview_ccg_bookmark(self, tmpfile, subprocess, finder): from test_bookmark_utils import _makeContext from django.conf import settings context = _makeContext(declines=[(Measure(id='foo'), 30, 10, 0)]) test_img_path = (settings.SITE_ROOT + '/frontend/tests/fixtures/' 'alert-email-image.png') finder.return_value.context_for_org_email.return_value = context tmpfile.return_value.__enter__.return_value.name = test_img_path url = reverse('preview-ccg-bookmark', kwargs={'code': PCT.objects.first().pk}) self.client.force_login(User.objects.get(username='******')) response = self.client.get(url) self.assertContains(response, "this CCG") with open(test_img_path, 'rb') as expected: self.assertContains(response, base64.b64encode(expected.read()))
def test_preview_ccg_bookmark(self, tmpfile, subprocess, finder): from test_bookmark_utils import _makeContext from django.conf import settings context = _makeContext(declines=[(Measure(id='foo'), 30, 10, 0)]) test_img_path = (settings.SITE_ROOT + '/frontend/tests/fixtures/' 'alert-email-image.png') finder.return_value.context_for_org_email.return_value = context tmpfile.return_value.__enter__.return_value.name = test_img_path url = reverse('preview-ccg-bookmark', kwargs={'code': PCT.objects.first().pk}) self.client.force_login(User.objects.get(username='******')) response = self.client.get(url) self.assertContains( response, "this CCG") with open(test_img_path, 'rb') as expected: self.assertContains( response, base64.b64encode(expected.read()))