def handle(self, *args, **kwargs): if settings.TESTING: result = runTests(suite) if len(result.errors) > 0 or len(result.failures)>0 or len(result.unexpectedSuccesses) > 0: exit(1) else: raise RuntimeError('Testing environment is not set')
def handle(self, *args, **kwargs): """Handle the call for this command.""" failfast = kwargs['failfast'] if settings.TESTING: if kwargs['test_modules']: test_suite = unittest.TestSuite([getattr(importlib.import_module( 'DRP.tests.' + module), 'suite') for module in kwargs['test_modules']]) else: test_suite = suite result = runTests(test_suite, failfast=failfast) if len(result.errors) > 0 or len(result.failures) > 0 or len(result.unexpectedSuccesses) > 0: exit(1) else: raise RuntimeError('Testing environment is not set')
def handle(self, *args, **kwargs): """Handle the call for this command.""" failfast = kwargs['failfast'] if settings.TESTING: if kwargs['test_modules']: test_suite = unittest.TestSuite([ getattr(importlib.import_module('DRP.tests.' + module), 'suite') for module in kwargs['test_modules'] ]) else: test_suite = suite result = runTests(test_suite, failfast=failfast) if len(result.errors) > 0 or len(result.failures) > 0 or len( result.unexpectedSuccesses) > 0: exit(1) else: raise RuntimeError('Testing environment is not set')
@logsInAs('Aslan', 'banana') @signsExampleLicense('Aslan') @usesCsrf class PostLabGroupPage(PostHttpSessionTest): """Posts to the page and checks that we joined the group.""" url = PostHttpTest.baseUrl + reverse('joinGroup') testCodes = ['00c9fe70-a51f-4c9a-9d99-b88292ece120'] def setUp(self): """Test that a lab group can be succesfully created.""" self.labGroup = LabGroup.objects.makeLabGroup( 'test', 'narnia', '*****@*****.**', 'old_magic') self.labGroup.save() self.response = self.s.post(self.url, data={ 'labGroup': self.labGroup.id, 'accessCode': 'old_magic', 'csrfmiddlewaretoken': self.csrf}) def tearDown(self): """Delete a labGroup.""" self.labGroup.delete() suite = unittest.TestSuite([ loadTests(LabGroupPage), loadTests(PostLabGroupPage) ]) if __name__ == '__main__': runTests(suite)
@logsInAs('Aslan', 'banana') @signsExampleLicense('Aslan') @usesCsrf class PostLabGroupPage(PostHttpSessionTest): """Posts to the page and checks that we joined the group.""" url = PostHttpTest.baseUrl + reverse('joinGroup') testCodes = ['00c9fe70-a51f-4c9a-9d99-b88292ece120'] def setUp(self): """Test that a lab group can be succesfully joined.""" self.labGroup = LabGroup.objects.makeLabGroup( 'test', 'narnia', '*****@*****.**', 'old_magic') self.labGroup.save() self.response = self.s.post(self.url, data={ 'labGroup': self.labGroup.id, 'accessCode': 'old_magic', 'csrfmiddlewaretoken': self.csrf}) def tearDown(self): """Delete a labGroup.""" self.labGroup.delete() suite = unittest.TestSuite([ loadTests(LabGroupPage), loadTests(PostLabGroupPage) ]) if __name__ == '__main__': runTests(suite)