Пример #1
0
    def test_get_field_id(self, url_read_mock):
        """ Test that the url is None when http error occurs. """
        jira = Jira('http://jira/', 'username', 'password')
        url_read_mock.return_value = '[{"id": "fn22", "name": "First Name"}]'

        result = jira.get_field_id("First Name")

        url_read_mock.assert_called_once_with('http://jira/rest/api/2/field')
        self.assertEqual("fn22", result)
Пример #2
0
    def test_get_field_id_http_error(self, url_read_mock):
        """ Test that the url is None when http error occurs. """
        jira = Jira('http://jira/', 'username', 'password')
        url_read_mock.side_effect = urllib.error.HTTPError(None, None, None, None, None)

        result = jira.get_field_id("First Name")

        url_read_mock.assert_called_once_with('http://jira/rest/api/2/field')
        self.assertEqual(None, result)
Пример #3
0
    def test_get_field_id(self, url_read_mock):
        """ Test that the url is None when http error occurs. """
        jira = Jira('http://jira/', 'username', 'password')
        url_read_mock.return_value = '[{"id": "fn22", "name": "First Name"}]'

        result = jira.get_field_id("First Name")

        url_read_mock.assert_called_once_with('http://jira/rest/api/2/field')
        self.assertEqual("fn22", result)
Пример #4
0
    def test_get_field_id_http_error(self, url_read_mock):
        """ Test that the url is None when http error occurs. """
        jira = Jira('http://jira/', 'username', 'password')
        url_read_mock.side_effect = urllib.error.HTTPError(
            None, None, None, None, None)

        result = jira.get_field_id("First Name")

        url_read_mock.assert_called_once_with('http://jira/rest/api/2/field')
        self.assertEqual(None, result)
Пример #5
0
    def test_get_field_id_not_exist(self, error_mock, url_read_mock):
        """ Test that the url is None when http error occurs. """
        jira = Jira('http://jira/', 'username', 'password')
        url_read_mock.return_value = '[{"id": "fn22", "name": "First Name"}]'

        result = jira.get_field_id("Some Other Name")

        url_read_mock.assert_called_once_with('http://jira/rest/api/2/field')
        error_mock.assert_called_once_with("Error retrieving id for the field with name %s.", "Some Other Name")
        self.assertEqual(None, result)
Пример #6
0
    def test_get_field_id_not_exist(self, error_mock, url_read_mock):
        """ Test that the url is None when http error occurs. """
        jira = Jira('http://jira/', 'username', 'password')
        url_read_mock.return_value = '[{"id": "fn22", "name": "First Name"}]'

        result = jira.get_field_id("Some Other Name")

        url_read_mock.assert_called_once_with('http://jira/rest/api/2/field')
        error_mock.assert_called_once_with(
            "Error retrieving id for the field with name %s.",
            "Some Other Name")
        self.assertEqual(None, result)