def setUpClass(cls): """A class method called before tests in an individual class are run""" cls.port = find_localhost_free_port() cls.old_endpoint = get_mock_endpoint() # Start mock server start_mock_server(cls.port)
def test_show_cluster_no_endpoint(self): """Ensure that the correct message is returned when a cluster is not set""" old_endpoint = get_mock_endpoint() set_mock_endpoint('') self.assertEqual(None, sf_c.show_connection()) set_mock_endpoint(str(old_endpoint))
def test_show_cluster(self): """Ensure that the correct message is returned when a cluster is set""" old_endpoint = get_mock_endpoint() set_mock_endpoint('https://testUrl.com') self.assertEqual('https://testUrl.com', sf_c.show_connection()) set_mock_endpoint(str(old_endpoint))
def __init__(self, method_name): cli_env = cli() super(ServiceFabricRequestTests, self).__init__(cli_env, method_name) # Save the value of cluster endpoint set by the user self.old_endpoint = get_mock_endpoint() self.port = find_localhost_free_port() # Start mock server start_mock_server(self.port)