Skip to content

Commit

Permalink
FIX Unit tests on issues API
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
  • Loading branch information
nlamirault committed Jun 4, 2015
1 parent 3e10734 commit fea9bf3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
27 changes: 16 additions & 11 deletions gitlab-issues.el
Expand Up @@ -32,8 +32,8 @@

(defun gitlab-list-issues (page per-page)
"Get all issues created by authenticated user.
STATE Return all issues or just those that are opened or closed
LABELS - Comma-separated list of label names"
PAGE: current page number
PER-PAGE: number of items on page max 100"
(let ((params '()))
(add-to-list 'params (cons 'per_page (number-to-string per-page)))
(add-to-list 'params (cons 'page (number-to-string page)))
Expand Down Expand Up @@ -69,11 +69,14 @@ ISSUE-ID : The ID of a project issue"

(defun gitlab-list-project-issues (project-id &optional page per-page)
"Get a list of project issues.
PROJECT-ID : The ID of a project"
PROJECT-ID : The ID of a project
PAGE: current page number
PER-PAGE: number of items on page max 100"
(let ((params '()))
(add-to-list 'params (cons 'per_page (number-to-string per-page)))
(add-to-list 'params (cons 'page (number-to-string page)))
(when page
(add-to-list 'params (cons 'per_page (number-to-string per-page))))
(when per-page
(add-to-list 'params (cons 'page (number-to-string page))))
(perform-gitlab-request "GET"
(s-concat "projects/"
(url-hexify-string
Expand All @@ -83,7 +86,10 @@ PROJECT-ID : The ID of a project"
200)))

(defun gitlab-list-all-project-issues (project-id &optional page per-page)
"Get a list of all PROJECT-ID issues."
"Get a list of all PROJECT-ID issues.
PROJECT-ID : The ID of a project
PAGE: current page number
PER-PAGE: number of items on page max 100"
(interactive)
(let* ((page 1)
(per-page 100)
Expand All @@ -98,8 +104,6 @@ PROJECT-ID : The ID of a project"
all-issues))




(defun gitlab-get-issue (project-id issue-id)
"Gets a single project issue.
Expand Down Expand Up @@ -145,10 +149,11 @@ LABELS comma-separated list label names"
"Create a project issue.
PROJECT-ID the ID or NAMESPACE%2FPROJECT_NAME of a project
ISSUE-ID : The ID of a project issue
TITLE issue title
DESCRIPTION issue description
ASSIGNEE assignee ID
MILESTONE milestone ID
ASSIGNEE-ID assignee ID
MILESTONE-ID milestone ID
LABELS comma-separated list label names"
(lwarn '(gitlab) :debug "UPDATE ISSUE in project: %s\n" project-id)
(perform-gitlab-request "PUT"
Expand Down
4 changes: 2 additions & 2 deletions test/gitlab-issues-test.el
Expand Up @@ -32,7 +32,7 @@
:tags '(issues)
(with-test-sandbox
(with-gitlab-session
(let ((issues (gitlab-list-issues)))
(let ((issues (gitlab-list-issues 1 20)))
(should (<= 0 (length issues)))
(mapcar (lambda (i)
(should (not (s-blank? (assoc-default 'title i))))
Expand All @@ -41,7 +41,7 @@
issues)))))

(ert-deftest test-list-project-issues ()
:tags '(issues)
:tags '(issues current)
(with-test-sandbox
(with-gitlab-session
(let ((issues (gitlab-list-project-issues gitlab-project-id)))
Expand Down

0 comments on commit fea9bf3

Please sign in to comment.