Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test for notify_packages_added

  • Loading branch information...
commit b0c37feb8e89b1e54de4073eb30ec96a358a4152 1 parent 307f7bd
Whit Morriss authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 tests/test_index.py
View
23 tests/test_index.py
@@ -91,6 +91,27 @@ def test_regenerate_leaf(self):
out = self.im.regenerate_leaf(info.name)
assert before_txt != out.text()
+ @patch('pyramid.threadlocal.get_current_registry')
+ def test_notify_packages_added(self, getreg):
+ from cheeseprism.index import notify_packages_added
+ pkg = dict(name='pkg', version='0.1'); pkgs = pkg,
+ index = Mock(name='index')
+ getreg.return_value = Mock(name='registry')
+ out = list(notify_packages_added(index, pkgs))
+
+ assert len(out) == 1
+ assert getreg.called
+ assert 'notify' in getreg.return_value._children
+ (event,), _ = getreg.return_value._children['notify'].call_args
+ assert event.im is index
+ assert event.version == '0.1'
+ assert event.name == 'pkg'
+
+ @raises(StopIteration)
+ def test_notify_packages_added_raises(self):
+ from cheeseprism.index import notify_packages_added
+ next(notify_packages_added(Mock(name='index'), []))
+
@patch('pkginfo.bdist.BDist', new=Mock(return_value=True))
def test_pkginfo_from_file_egg(self):
from cheeseprism.index import IndexManager
@@ -118,5 +139,7 @@ def tearDown(self):
logger.info(pprint(dirs))
logger.info(pprint([x.rmtree() for x in dirs]))
+
+
def test_cleanup():
assert not IndexTestCase.get_base().dirs()
Please sign in to comment.
Something went wrong with that request. Please try again.