def test_company(self): company = self.company json_data = company_adapter(company, self.dummy_request) expected = dict( guid=company.guid, api_key=company.api_key, created_at=company.created_at.isoformat(), updated_at=company.updated_at.isoformat(), ) self.assertEqual(json_data, expected)
def test_company(self): from billy.models.company import CompanyModel from billy.renderers import company_adapter company_model = CompanyModel(self.testapp.session) company = company_model.get(self.company_guid) json_data = company_adapter(company, self.dummy_request) expected = dict( guid=company.guid, api_key=company.api_key, created_at=company.created_at.isoformat(), updated_at=company.updated_at.isoformat(), ) self.assertEqual(json_data, expected)
def test_company_with_callback_key(self): company = self.company self.dummy_request.registry.settings = {} settings = self.dummy_request.registry.settings settings['billy.company.display_callback_key'] = True json_data = company_adapter(company, self.dummy_request) expected = dict( guid=company.guid, api_key=company.api_key, callback_key=company.callback_key, created_at=company.created_at.isoformat(), updated_at=company.updated_at.isoformat(), ) self.assertEqual(json_data, expected)