Skip to content

Commit

Permalink
Additional test coverage for bad configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Smith committed May 15, 2017
1 parent 4c4e478 commit 04f76a2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions applications/multisite/intersite_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ def test_site_with_bad_ipaddress(self):

self.assertRaises(ValueError, execute_tool, args, test_mode=True)

def test_site_with_bad_ipaddress_as_number(self):
"""
Test invalid IP address value in the JSON. Verify that the correct exception is generated.
:return: None
"""
args = self.get_args()
config = self.create_empty_config_file()
config['config'][0]['site']['ip_address'] = 100
self.create_config_file(args, config)

self.assertRaises(TypeError, execute_tool, args, test_mode=True)

def test_site_with_good_ipaddress_and_bad_userid(self):
"""
Test good IP address value but invalid username in the JSON. Verify that the correct exception is generated.
Expand Down Expand Up @@ -457,6 +469,13 @@ def test_duplicate_export_policy(self):
self.create_config_file(args, config)
self.assertRaises(ValueError, execute_tool, args, test_mode=True)

def test_bad_intersite_tag(self):
"""
Test bad intersite tag creation
"""
with self.assertRaises(AssertionError):
IntersiteTag.fromstring('badstring')


class BaseTestCase(unittest.TestCase):
"""
Expand Down

0 comments on commit 04f76a2

Please sign in to comment.