def test_post_ok(self): contract = create_contract(self) contract_id = contract.data.id contract_before_document_post = get_contract(self, contract_id) assert contract_before_document_post.documents == [] response = post_document(self, contract) assert response.status == '201 Created' contract_after_document_post = get_contract(self, contract_id) assert len(contract_after_document_post.documents) == 1
def prepare_milestones(test_case, contract_data=None): """Prepares contract's milestones to make financing milestone have processing status """ contract = create_contract(test_case, contract_data) patch_contract_url = ENDPOINTS['contracts'].format( contract_id=contract.data.id) + "?acc_token={}".format( contract.access.token) # milestones will be populated when status changes to 'active.payment' contract_patch_response = test_case.app.patch_json( patch_contract_url, {'data': { 'status': 'active.payment' }}) test_case.assertEqual(contract_patch_response.status, '200 OK') milestones = munchify(contract_patch_response.json['data']['milestones']) return (contract, milestones)
def test_post_with_wrong_user(self): contract = create_contract(self) self.app.authorization = ('Basic', ('petro', '')) post_document(self, contract, status_code=403)
def prepare_contract_with_document(test_case, contract_data=None): contract = create_contract(test_case, contract_data) response = post_document(test_case, contract) document = munchify(response.json) return (contract, document)
def test_milestone_post(self): contract = create_contract(self) self.app.post_json(ENDPOINTS['milestones_collection'].format( contract_id=contract.data.id), status=404)