def test_doing_a_merge(self): make_production('Hamlet', 'A tragedy', [ 'Shakespeare Productions' ], [ { 'name': 'Theatre', 'start': '2013-01-01', 'end': '2013-01-14' } ]) make_production('Hamlet', 'A tragedy', [ 'Shakespeare Productions' ], [ { 'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14' } ]) resp = self.client.get('/play/1/hamlet/production/1') self.assertContains(resp, 'Hamlet') resp = self.client.get('/play/1/hamlet/production/2') self.assertContains(resp, 'Hamlet') resp = self.client.get('/play/1/hamlet/production/2/merge') self.assertContains(resp, 'Thanks for helping improve the accuracy of the site.') resp = self.client.get('/play/1/hamlet/production/2') self.assertNotContains(resp, 'This is a duplicate') resp = self.client.get('/play/1/hamlet/production/1') self.assertContains(resp, 'This is a duplicate of Shakespeare Productions production of Hamlet') resp = self.client.post('/play/1/hamlet/production/1/merge', { 'dupe': True }) self.assertContains(resp, 'Thanks again for helping') self.assertEqual(len(mail.outbox), 1)
def setUp(self): prod = make_production( 'Hamlet', 'A tragedy', ['Shakespeare Productions'], [{'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14'}], [{'first': u'Matthew', 'last': u'Somerville', 'role': 'Laertes'}] ) self.company_id = prod.companies.all()[0].id32
def test_short_url(self): prod = make_production( 'Hamlet', 'A tragedy', ['Shakespeare Productions'], [{'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14'}], [{'first': u'Matthew', 'last': u'Somerville', 'role': 'Laertes'}] ) resp = self.client.get('/d/%s' % prod.id32) self.assertRedirects(resp, '/play/%s/hamlet/production/%s' % (prod.play.id32, prod.id32), status_code=301)
def setUp(self): prod = make_production('Hamlet', 'A tragedy', ['Shakespeare Productions'], [{ 'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14' }], [{ 'first': u'Matthew', 'last': u'Somerville', 'role': 'Laertes' }]) self.place_id = prod.places.all()[0].id32 make_production('Hamlet', 'Another tragedy', ['Shakespeare Productions'], [{ 'name': 'Bournville Theatre', 'start': '2013-02-01', 'end': '2013-02-14' }], [{ 'first': u'Matthew', 'last': u'Boulton', 'role': 'Hamlet' }])
def test_doing_a_merge(self): make_production('Hamlet', 'A tragedy', ['Shakespeare Productions'], [{ 'name': 'Theatre', 'start': '2013-01-01', 'end': '2013-01-14' }]) make_production('Hamlet', 'A tragedy', ['Shakespeare Productions'], [{ 'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14' }]) resp = self.client.get('/play/1/hamlet/production/1') self.assertContains(resp, 'Hamlet') resp = self.client.get('/play/1/hamlet/production/2') self.assertContains(resp, 'Hamlet') resp = self.client.get('/play/1/hamlet/production/2/merge') self.assertContains( resp, 'Thanks for helping improve the accuracy of the site.') resp = self.client.get('/play/1/hamlet/production/2') self.assertNotContains(resp, 'This is a duplicate') resp = self.client.get('/play/1/hamlet/production/1') self.assertContains( resp, 'This is a duplicate of Shakespeare Productions production of Hamlet' ) resp = self.client.post('/play/1/hamlet/production/1/merge', {'dupe': True}) self.assertContains(resp, 'Thanks again for helping') self.assertEqual(len(mail.outbox), 1) resp = self.client.post('/play/1/hamlet/production/1/merge', {'stop': True}, follow=True) self.assertRedirects(resp, '/play/1/hamlet/production/1')
def setUp(self): prod = make_production('Hamlet', 'A tragedy', [ 'Shakespeare Productions' ], [ { 'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14' } ], [ { 'first': u'Matthew', 'last': u'Somerville', 'role': 'Laertes' } ]) self.company_id = prod.companies.all()[0].id32
def test_short_url(self): prod = make_production('Hamlet', 'A tragedy', [ 'Shakespeare Productions' ], [ { 'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14' } ], [ { 'first': u'Matthew', 'last': u'Somerville', 'role': 'Laertes' } ]) resp = self.client.get('/d/%s' % prod.id32) self.assertRedirects(resp, '/play/%s/hamlet/production/%s' % (prod.play.id32, prod.id32), status_code=301)
def setUp(self): prod = make_production('Hamlet', 'A tragedy', [ 'Shakespeare Productions' ], [ { 'name': 'Stirchley Theatre', 'start': '2013-01-01', 'end': '2013-01-14' } ], [ { 'first': u'Matthew', 'last': u'Somerville', 'role': 'Laertes' } ]) self.place_id = prod.places.all()[0].id32 make_production('Hamlet', 'Another tragedy', [ 'Shakespeare Productions' ], [ { 'name': 'Bournville Theatre', 'start': '2013-02-01', 'end': '2013-02-14' } ], [ { 'first': u'Matthew', 'last': u'Boulton', 'role': 'Hamlet' } ])