def test_product_model(self): product = Product('Billing') product.create(product) self.assertTrue(product.id) self.assertTrue(product.created_at) self.assertTrue(product == Product.find_by(name='Billing'))
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 create_request(): client_1 = Client('ClientA') client_1.insert(client_1) client_2 = Client('ClientB') client_2.insert(client_2) client_3 = Client('ClientC') client_3.insert(client_3) Client.save() product_1 = Product('Policies') product_1.insert(product_1) product_2 = Product('Billing') product_2.insert(product_2) Product.save() request = Request(title='Add Login Page', description='Client want to have oauth base login', client=client_1.id, client_priority=1, target_date='2016-12-01', product_area=product_1.id) request.insert(request) request = Request( title='Add Bootstrap in User Module', description= 'Client want to have bootstrap framework in user module', client=client_2.id, client_priority=2, target_date='2016-11-12', product_area=product_2.id) request.insert(request) request = Request( title='Implement Send Mail Feature', description= 'Client want to mail where he/she can send direct mail to them from own domain', client=client_1.id, client_priority=2, target_date='2017-01-01', product_area=product_1.id) request.insert(request) request.save()
def test_post_for_feature_request(self): FeatureRequestUtils.create_request() client = Client.find_by(name='ClientA') product = Product.find_by(name='Billing') feature_request = { 'title': 'Automate the deployment to AWS Server', 'description': 'As a client I can deploy the latest change to AWS Server for demo', "client_id": client.id, "client_priority": 1, "product_id": product.id, "target_date": '2017-09-20' } expected = {'status': 'success', 'reason': 'Feature request added'} response = self.app.post('/api/feature-request/', data=json.dumps(feature_request), content_type='application/json') response_data = json.loads(response.data) del response_data['feature_request'] self.assertEqual(response_data, expected) self.assertEqual(response.status_code, 201)
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)
def test_post_getting_saved(self): FeatureRequestUtils.create_request() client = Client.find_by(name='ClientA') product = Product.find_by(name='Billing') feature_request = { 'title': 'Automate the deployment to AWS Server', 'description': 'As a client I can deploy the latest change to AWS Server for demo', "client_id": client.id, "client_priority": 1, "product_id": product.id, "target_date": '2017-09-20' } response = self.app.post('/api/feature-request/', data=json.dumps(feature_request), content_type='application/json') response = self.app.get('/api/feature-request/') response_data = json.loads(response.data) self.assertEqual(response.status_code, 200) self.assertEqual(len(response_data["feature_requests"]), 4)
def __init__(self): client_1 = Client('Client_A') client_1.insert(client_1) client_2 = Client('Client_B') client_2.insert(client_2) client_3 = Client('Client_C') client_3.insert(client_3) Client.save() product_1 = Product('Policies') product_1.insert(product_1) product_2 = Product('Billing') product_2.insert(product_2) product_3 = Product('Claims') product_3.insert(product_3) product_4 = Product('Reports') product_4.insert(product_4) Product.save() request_1 = Request( title='Public User Profile', description= 'A public user profile that can be visited by clicking on any users name from the organisation view', client=client_1.id, client_priority=1, product_area=product_2.id, target_date='2017-1-20') request_1.insert(request_1) request_2 = Request( title='Email system for sending emails and email verification', description= 'User email validation is where we verify a users email when they sign up with a token/code sent to their inbox', client=client_2.id, client_priority=2, product_area=product_3.id, target_date='2016-12-2') request_2.insert(request_2) request_3 = Request( title='Add customer satisfaction survey', description= 'Client wants to be able to send out a survey to evaluate customer satisfaction after issuing a new claim', client=client_3.id, client_priority=1, product_area=product_1.id, target_date='2016-11-11') request_3.insert(request_3) request_3.save() print "Successfully add data to db"