Beispiel #1
0
    def test_issue(self):
        """Test if issue call works"""

        body = read_file('data/redmine/redmine_issue_7311.json')

        httpretty.register_uri(httpretty.GET,
                               REDMINE_ISSUE_7311_URL,
                               body=body, status=200)

        client = RedmineClient(REDMINE_URL, 'aaaa')

        result = client.issue(7311)

        self.assertEqual(result, body)

        expected = {
                    'key' : ['aaaa'],
                    'include' : ['attachments,changesets,children,journals,relations,watchers']
                   }

        req = httpretty.last_request()

        self.assertEqual(req.method, 'GET')
        self.assertRegex(req.path, '/issues/7311.json')
        self.assertDictEqual(req.querystring, expected)
Beispiel #2
0
    def test_issues(self):
        """Test if issues call works"""

        body = read_file('data/redmine/redmine_issues_next.json')

        httpretty.register_uri(httpretty.GET,
                               REDMINE_ISSUES_URL,
                               body=body, status=200)

        client = RedmineClient(REDMINE_URL, 'aaaa')
        dt = datetime.datetime(2016, 7, 1, 0, 0, 0)

        result = client.issues(from_date=dt, offset=10, max_issues=200)

        self.assertEqual(result, body)

        expected = {
                    'key' : ['aaaa'],
                    'status_id' : ['*'],
                    'sort' : ['updated_on'],
                    'updated_on' : ['>=2016-07-01T00:00:00Z'],
                    'offset' : ['10'],
                    'limit' : ['200']
                   }

        req = httpretty.last_request()

        self.assertEqual(req.method, 'GET')
        self.assertRegex(req.path, '/issues.json')
        self.assertDictEqual(req.querystring, expected)
Beispiel #3
0
    def test_issue(self):
        """Test if issue call works"""

        body = read_file('data/redmine/redmine_issue_7311.json')

        httpretty.register_uri(httpretty.GET,
                               REDMINE_ISSUE_7311_URL,
                               body=body,
                               status=200)

        client = RedmineClient(REDMINE_URL, 'aaaa')

        result = client.issue(7311)

        self.assertEqual(result, body)

        expected = {
            'key': ['aaaa'],
            'include':
            ['attachments,changesets,children,journals,relations,watchers']
        }

        req = httpretty.last_request()

        self.assertEqual(req.method, 'GET')
        self.assertRegex(req.path, '/issues/7311.json')
        self.assertDictEqual(req.querystring, expected)
Beispiel #4
0
    def test_issues(self):
        """Test if issues call works"""

        body = read_file('data/redmine/redmine_issues_next.json')

        httpretty.register_uri(httpretty.GET,
                               REDMINE_ISSUES_URL,
                               body=body,
                               status=200)

        client = RedmineClient(REDMINE_URL, 'aaaa')
        dt = datetime.datetime(2016, 7, 1, 0, 0, 0)

        result = client.issues(from_date=dt, offset=10, max_issues=200)

        self.assertEqual(result, body)

        expected = {
            'key': ['aaaa'],
            'status_id': ['*'],
            'sort': ['updated_on'],
            'updated_on': ['>=2016-07-01T00:00:00Z'],
            'offset': ['10'],
            'limit': ['200']
        }

        req = httpretty.last_request()

        self.assertEqual(req.method, 'GET')
        self.assertRegex(req.path, '/issues.json')
        self.assertDictEqual(req.querystring, expected)
Beispiel #5
0
    def test_user(self):
        """Test if user call works"""

        body = read_file('data/redmine/redmine_user_3.json')

        httpretty.register_uri(httpretty.GET,
                               REDMINE_USER_3_URL,
                               body=body,
                               status=200)

        client = RedmineClient(REDMINE_URL, 'aaaa')

        result = client.user(3)

        self.assertEqual(result, body)

        expected = {'key': ['aaaa']}

        req = httpretty.last_request()

        self.assertEqual(req.method, 'GET')
        self.assertRegex(req.path, '/users/3.json')
        self.assertDictEqual(req.querystring, expected)
Beispiel #6
0
    def test_user(self):
        """Test if user call works"""

        body = read_file('data/redmine/redmine_user_3.json')

        httpretty.register_uri(httpretty.GET,
                               REDMINE_USER_3_URL,
                               body=body, status=200)

        client = RedmineClient(REDMINE_URL, 'aaaa')

        result = client.user(3)

        self.assertEqual(result, body)

        expected = {
                    'key' : ['aaaa']
                   }

        req = httpretty.last_request()

        self.assertEqual(req.method, 'GET')
        self.assertRegex(req.path, '/users/3.json')
        self.assertDictEqual(req.querystring, expected)
Beispiel #7
0
    def test_init(self):
        """Test initialization parameters"""

        client = RedmineClient(REDMINE_URL, 'aaaa')
        self.assertEqual(client.base_url, REDMINE_URL)
        self.assertEqual(client.api_token, 'aaaa')