Permalink
Browse files

new test for org update

  • Loading branch information...
1 parent 790dc4a commit 6aad78a3e17bd00240d10560141f2bcbd01e7800 @sigma committed Apr 9, 2012
Showing with 23 additions and 2 deletions.
  1. +23 −2 tests/gh-orgs-tests.el
View
@@ -29,10 +29,15 @@
(require 'gh-tests)
(require 'gh-orgs)
-(defun gh-orgs-tests:test-regular-org (org)
+(defun gh-orgs-tests:test-regular-org-stub (org)
(should (equal (oref org :id) 1))
(should (equal (oref org :login) "github")))
+(defun gh-orgs-tests:test-regular-org (org)
+ (gh-orgs-tests:test-regular-org-stub org)
+ (should (equal (oref org :public-gists) 1))
+ (should (equal (oref org :public-repos) 2)))
+
(ert-deftest gh-orgs-tests:regular-list ()
(let* ((api (gh-tests-mock-api 'gh-orgs-api))
(orgs
@@ -43,7 +48,7 @@
(should (equal (length orgs) 1))
(let ((org (car orgs)))
(should (object-of-class-p org 'gh-orgs-org-stub))
- (gh-orgs-tests:test-regular-org org))))
+ (gh-orgs-tests:test-regular-org-stub org))))
(ert-deftest gh-orgs-tests:regular-get ()
(let* ((api (gh-tests-mock-api 'gh-orgs-api))
@@ -55,5 +60,21 @@
(should (object-of-class-p org 'gh-orgs-org))
(gh-orgs-tests:test-regular-org org)))
+(ert-deftest gh-orgs-tests:regular-update ()
+ (let* ((api (gh-tests-mock-api 'gh-orgs-api))
+ (org-stub
+ (make-instance 'gh-orgs-org
+ :login "github"
+ :id 1
+ :url "https://api.github.com/orgs/1"
+ :avatar-url "https://github.com/images/error/octocat_happy.gif"))
+ (org
+ (gh-tests-with-traces-buffers ((orgs-buf "get_org_sample.txt"))
+ (gh-tests-mock-url ((:record-cls mocker-stub-record
+ :output orgs-buf))
+ (oref (gh-orgs-update api org-stub) :data)))))
+ (should (object-of-class-p org 'gh-orgs-org))
+ (gh-orgs-tests:test-regular-org org)))
+
(provide 'gh-orgs-tests)
;;; gh-orgs-tests.el ends here

0 comments on commit 6aad78a

Please sign in to comment.