diff --git a/tests/common.py b/tests/common.py index d35ce6a..90fe6b6 100644 --- a/tests/common.py +++ b/tests/common.py @@ -10,8 +10,8 @@ def get_test_config(): Returns a basic FedexConfig to test with. """ # Test server (Enter your credentials here) - return FedexConfig(key='xxxxxxxxxxxxxxxxx', - password='xxxxxxxxxxxxxxxxxxxxxxxxx', - account_number='xxxxxxxxx', - meter_number='xxxxxxxxxx', + return FedexConfig(key='', + password='', + account_number='', + meter_number='', use_test_server=True) diff --git a/tests/test_address_validation_service.py b/tests/test_address_validation_service.py index 43173d0..2e0c0e3 100644 --- a/tests/test_address_validation_service.py +++ b/tests/test_address_validation_service.py @@ -15,6 +15,7 @@ CONFIG_OBJ = get_test_config() +@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.") class AddressValidationServiceTests(unittest.TestCase): """ These tests verify that the address validation service WSDL is in good shape. diff --git a/tests/test_availability_commitment_service.py b/tests/test_availability_commitment_service.py index 1d1e9c6..ff4e3ce 100644 --- a/tests/test_availability_commitment_service.py +++ b/tests/test_availability_commitment_service.py @@ -15,6 +15,7 @@ CONFIG_OBJ = get_test_config() +@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.") class AvailabilityCommitmentServiceTests(unittest.TestCase): """ These tests verify that the shipping service WSDL is in good shape. diff --git a/tests/test_config_object.py b/tests/test_config_object.py new file mode 100644 index 0000000..b180548 --- /dev/null +++ b/tests/test_config_object.py @@ -0,0 +1,39 @@ +""" +Test module for the Fedex Config Object. +""" + +import unittest + +import sys + +sys.path.insert(0, '..') +from fedex.config import FedexConfig + + + + +class FedexConfigObjectTests(unittest.TestCase): + """ + These tests verify that the fedex config object is working properly. + """ + + def test_fedex_config(self): + # Need to pass at least key and password + with self.assertRaises(TypeError): + FedexConfig() + + # Test minimum set of credentials, key and password + config = FedexConfig('key', 'password') + assert config.key + assert config.password + + # Test with all parameters, including overwrite wsdl path + config = FedexConfig(key='', password='', account_number=None, meter_number=None, + freight_account_number=None, + integrator_id=None, wsdl_path='/wsdls', + express_region_code=None, use_test_server=False) + + assert config.wsdl_path + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_package_movement_service.py b/tests/test_package_movement_service.py index 1164fa2..3389703 100644 --- a/tests/test_package_movement_service.py +++ b/tests/test_package_movement_service.py @@ -15,6 +15,7 @@ CONFIG_OBJ = get_test_config() +@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.") class PackageMovementServiceTests(unittest.TestCase): """ These tests verify that the package movement service WSDL is in good shape. diff --git a/tests/test_rate_service.py b/tests/test_rate_service.py index 2cd3777..52e4577 100644 --- a/tests/test_rate_service.py +++ b/tests/test_rate_service.py @@ -15,6 +15,7 @@ CONFIG_OBJ = get_test_config() +@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.") class RateServiceTests(unittest.TestCase): """ These tests verify that the rate service WSDL is in good shape. diff --git a/tests/test_ship_service.py b/tests/test_ship_service.py index 2a4061a..860a69b 100644 --- a/tests/test_ship_service.py +++ b/tests/test_ship_service.py @@ -16,6 +16,7 @@ CONFIG_OBJ = get_test_config() +@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.") class ShipServiceTests(unittest.TestCase): """ These tests verify that the ship service WSDL is in good shape. diff --git a/tests/test_track_service.py b/tests/test_track_service.py index b20d65e..1f9f826 100644 --- a/tests/test_track_service.py +++ b/tests/test_track_service.py @@ -15,6 +15,7 @@ CONFIG_OBJ = get_test_config() +@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.") class TrackServiceTests(unittest.TestCase): """ These tests verify that the shipping service WSDL is in good shape.