Esempio n. 1
0
    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)
Esempio n. 2
0
    def __init__(self, method_name):
        cli_env = cli()
        super(ServiceFabricRequestTests, self).__init__(cli_env, method_name)

        # Save the value of SF_TEST_ENDPOINT set by the user
        self.old_endpoint = environ.get('SF_TEST_ENDPOINT', '')
        self.port = find_localhost_free_port()

        # Start mock server
        start_mock_server(self.port)
    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)
Esempio n. 4
0
    def paths_generation_test(self):
        """ This test calls all commands that exist within sfctl.
        The commands are routed to a mock cluster which always returns
        success.We then read the values of the URL and other request
        features to determine that the command is working as expected
        (generating the correct URL). """

        # Set test URL path to that of our mock server
        environ['SF_TEST_ENDPOINT'] = 'http://localhost:' + str(self.port)
        # Start mock server
        start_mock_server(self.port)
        # Call test
        self.paths_generation_helper()
        # Reset test URL to user set value
        environ['SF_TEST_ENDPOINT'] = self.old_enpoint