Skip to content

Commit

Permalink
skip tests when no credentials available
Browse files Browse the repository at this point in the history
  • Loading branch information
radzhome committed Jan 6, 2016
1 parent 8622dfe commit 9276f42
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions tests/test_address_validation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/test_availability_commitment_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
39 changes: 39 additions & 0 deletions tests/test_config_object.py
Original file line number Diff line number Diff line change
@@ -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()
1 change: 1 addition & 0 deletions tests/test_package_movement_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/test_rate_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/test_ship_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/test_track_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9276f42

Please sign in to comment.