def setUp(self): AppReport.configure({ 'app_name': 'app-name', 'access_key': 'access-key', 'secret_key': 'secret-key' }) self.default_report_options = { 'template_name': 'some_report', 'data_type': 'xml', 'data': '<?xml version="1.0" encoding="utf-8"?><root><node></node></root>', 'xpath_expression': '/root/node', 'args': {'key': 'value'} } self.api = app_report.api.Jasper() self.report = app_report.report.Jasper(**self.default_report_options)
def setUp(self): AppReport.configure({ 'app_name': 'app', 'access_key': 'L3jC1SHoo3mqWZ2kT7m4', 'secret_key': '6zD1sMPAYJdBj/SUMqi/BIqayWkjx3PSV1KaQyND' }) self.base_api_class = app_report.api.Base self.base_api = self.base_api_class() # using fake api to test custom params self.fake_api = test.app_report.api.FakeAPI() self.fake_api.params = { 'document': '123456789abc', 'id': 123 }
def test_configure_dict_change_settings(self): AppReport.configure({'app_name': 'app-name1'}) self.assertEqual(AppReport.settings.app_name, 'app-name1')
def test_settings_validation(self): with self.assertRaisesRegexp(app_report.errors.RequiredConfigurationError, '.* is required'): AppReport.configure({'app_name': None})
def test_configure_raise_invalid_configuration_key_error(self): with self.assertRaisesRegexp(app_report.errors.InvalidConfigurationKeyError, 'invalid configuration key: .*'): AppReport.configure({'invalid_key': 'foo'})
def test_configure_return_settings(self): self.assertEqual(AppReport.configure({}), AppReport.settings)
def setUp(self): AppReport.configure({ 'app_name': 'app', 'access_key': '123', 'secret_key': '123abc' })