def test_purchase_package_return_value( mock_inconnection_enter, mock_inconnection_exit ): # Arrange mock_msisdn = mock.ANY mock_package_type = mock.ANY mock_package_grade = mock.ANY mock_profile = mock.ANY mock_current_user = mock.Mock() mock_inconnection_enter.return_value.purchase_package.return_value = True mock_host = '172.18.0.2' mock_port = 7090 mock_buffer_size = 4096 prepaid_request = INRequestHandler( host=mock_host, port=mock_port, buffer_size=mock_buffer_size) # Act success_result = prepaid_request.purchase_package( msisdn=mock_msisdn, current_profile=mock_profile, package_type=mock_package_type, current_user=mock_current_user, package_grade=mock_package_grade) # Assert assert success_result == { 'operationResult': 'OK', 'msisdn': mock_msisdn, 'packageType': mock_package_type, 'packageGrade': mock_package_grade }
def test_purchase_package_failed( mock_inconnection_enter, mock_inconnection_exit ): # Arrange mock_msisdn = mock.ANY mock_package_type = mock.ANY mock_package_grade = mock.ANY mock_profile = mock.ANY mock_current_user = mock.Mock() mock_inconnection_enter.return_value.purchase_package.return_value = False prepaid_request = INRequestHandler( None, None, None ) # Act success_result = prepaid_request.purchase_package( msisdn=mock_msisdn, current_profile=mock_profile, package_type=mock_package_type, current_user=mock_current_user, package_grade=mock_package_grade) # Assert assert success_result == { 'operationResult': 'FAILED', 'msisdn': mock_msisdn, 'packageType': mock_package_type, 'packageGrade': mock_package_grade }
def test_purchase_package_returns_dict( mock_inconnection_enter, mock_inconnection_exit ): # Arrange mock_msisdn = mock.ANY mock_package_type = mock.ANY mock_package_grade = mock.ANY mock_profile = mock.ANY mock_current_user = mock.Mock() mock_inconnection_enter.return_value.purchase_package.return_value = True prepaid_request = INRequestHandler( None, None, None ) # Act success_result = prepaid_request.purchase_package( msisdn=mock_msisdn, current_profile=mock_profile, package_type=mock_package_type, current_user=mock_current_user, package_grade=mock_package_grade) # Assert assert isinstance(success_result, dict)