Commits

Brad Montgomery committed 77e7eea

started some tests

Comments (0)

Files changed (2)

bitbucket/tests/__init__.py

Empty file added.

bitbucket/tests/test_bitbucket.py

+from nose.tools import eq_
+from bitbucket import *
+
+
+def test_bitbucket():
+    bb = BitBucket()
+    eq_("<BitBucket API>", "%s" % bb)
+
+    # _loads
+    # build_request
+    # load_url
+
+    # user
+    user = bb.user('bkmontgomery')
+    eq_(user.bb, bb)
+    eq_(user.username, 'bkmontgomery')
+    # Test user methods in ``test_user``
+
+
+    # repository
+    repo = bb.repository('bkmontgomery', 'python-bitbucket')
+
+    # --- the following methods require authentication ---
+    # new_repository
+    # remove_repository
+    # emails
+
+def test_user():
+    bb = BitBucket()
+    user = bb.user('bkmontgomery')
+
+    followers = user.followers()
+    eq_(followers.keys(), [u'count', u'followers'])
+
+    repo = user.repository('python-bitbucket')
+    eq_("<Repository: bkmontgomery's python-bitbucket>", '%s' % repo)
+
+    repos = user.repositories()
+    eq_(len(repos) > 0, True)
+    eq_(len(filter(lambda x: x['name'] == 'python-bitbucket', repos)), 1)
+
+    # events
+    # get
+    
+    eq_('<User: bkmontgomery>', '%s' % user)
+
+