Skip to content

Commit 9276f42

Browse files
committed
skip tests when no credentials available
1 parent 8622dfe commit 9276f42

8 files changed

+49
-4
lines changed

tests/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def get_test_config():
1010
Returns a basic FedexConfig to test with.
1111
"""
1212
# Test server (Enter your credentials here)
13-
return FedexConfig(key='xxxxxxxxxxxxxxxxx',
14-
password='xxxxxxxxxxxxxxxxxxxxxxxxx',
15-
account_number='xxxxxxxxx',
16-
meter_number='xxxxxxxxxx',
13+
return FedexConfig(key='',
14+
password='',
15+
account_number='',
16+
meter_number='',
1717
use_test_server=True)

tests/test_address_validation_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
CONFIG_OBJ = get_test_config()
1616

1717

18+
@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.")
1819
class AddressValidationServiceTests(unittest.TestCase):
1920
"""
2021
These tests verify that the address validation service WSDL is in good shape.

tests/test_availability_commitment_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
CONFIG_OBJ = get_test_config()
1616

1717

18+
@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.")
1819
class AvailabilityCommitmentServiceTests(unittest.TestCase):
1920
"""
2021
These tests verify that the shipping service WSDL is in good shape.

tests/test_config_object.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
Test module for the Fedex Config Object.
3+
"""
4+
5+
import unittest
6+
7+
import sys
8+
9+
sys.path.insert(0, '..')
10+
from fedex.config import FedexConfig
11+
12+
13+
14+
15+
class FedexConfigObjectTests(unittest.TestCase):
16+
"""
17+
These tests verify that the fedex config object is working properly.
18+
"""
19+
20+
def test_fedex_config(self):
21+
# Need to pass at least key and password
22+
with self.assertRaises(TypeError):
23+
FedexConfig()
24+
25+
# Test minimum set of credentials, key and password
26+
config = FedexConfig('key', 'password')
27+
assert config.key
28+
assert config.password
29+
30+
# Test with all parameters, including overwrite wsdl path
31+
config = FedexConfig(key='', password='', account_number=None, meter_number=None,
32+
freight_account_number=None,
33+
integrator_id=None, wsdl_path='/wsdls',
34+
express_region_code=None, use_test_server=False)
35+
36+
assert config.wsdl_path
37+
38+
if __name__ == "__main__":
39+
unittest.main()

tests/test_package_movement_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
CONFIG_OBJ = get_test_config()
1616

1717

18+
@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.")
1819
class PackageMovementServiceTests(unittest.TestCase):
1920
"""
2021
These tests verify that the package movement service WSDL is in good shape.

tests/test_rate_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
CONFIG_OBJ = get_test_config()
1616

1717

18+
@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.")
1819
class RateServiceTests(unittest.TestCase):
1920
"""
2021
These tests verify that the rate service WSDL is in good shape.

tests/test_ship_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
CONFIG_OBJ = get_test_config()
1717

1818

19+
@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.")
1920
class ShipServiceTests(unittest.TestCase):
2021
"""
2122
These tests verify that the ship service WSDL is in good shape.

tests/test_track_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
CONFIG_OBJ = get_test_config()
1616

1717

18+
@unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.")
1819
class TrackServiceTests(unittest.TestCase):
1920
"""
2021
These tests verify that the shipping service WSDL is in good shape.

0 commit comments

Comments
 (0)