def test_get_response_for_feature_request(self): expected_data = { "feature_requests": [{ "client_name": "Client_A", "client_priority": 1, "description": "this is test", "product_area": "Billing", "target_date": "Tue, 30 Aug 2016 15:49:56 GMT", "title": "test" }] } product = Product('Billing') product.create(product) client = Client('Client_A') client.create(client) request = Request(title='test', description='this is test', client=client.id, client_priority=1, target_date='2016-12-22', product_area=product.id) request.create(request) response = self.app.get('/api/feature-request/') self.assertEqual(response.status_code, 200) response_data = json.loads(response.data) self.assertEqual(len(response_data['feature_requests']), 1) self.assertEqual(response_data['feature_requests'][0]['client_name'], expected_data['feature_requests'][0]['client_name'])
def test_product_model(self): client = Client('Client_A') client.create(client) self.assertTrue(client.id) self.assertTrue(client.created_at) self.assertTrue(client == Client.find_by(name='Client_A'))
def test_request_model(self): product = Product('Billing') product.create(product) client = Client('Client_A') client.create(client) request = Request(title='test', description='this is test', client=client.id, client_priority=1, target_date='2017-03-12', product_area=product.id) request.create(request) find_all_request = Request.query.filter().all() self.assertTrue('test' == find_all_request[0].title) self.assertTrue('this is test' == find_all_request[0].description) self.assertTrue(client.id == find_all_request[0].client) self.assertTrue(product.id == find_all_request[0].product_area)