def test_rate_limit(): assert redis.exists(POLL_SIMPLE_THROTTLE) assert update_package_list() is None redis.delete(POLL_SIMPLE_THROTTLE) assert not redis.exists(POLL_SIMPLE_THROTTLE) assert list() == update_package_list() assert redis.exists(POLL_SIMPLE_THROTTLE) assert update_package_list() is None
def test_updating(alter_xmlrpc): value = [ dict(name='packageA', summary='Test package.', version='2.0.0-beta'), dict(name='packageB', summary='Test package.', version='3.0.0'), ] alter_xmlrpc(value) redis.delete(POLL_SIMPLE_THROTTLE) assert sorted(['packageA', 'packageB']) == sorted(update_package_list()) expected = [ ('packageA', 'Test package.', '2.0.0-beta'), ('packageB', 'Test package.', '3.0.0'), ] actual = db.session.query(Package.name, Package.summary, Package.latest_version).all() assert expected == actual value = [ dict(name='packageA', summary='Test package.', version='2.0.0'), dict(name='packageB', summary='Test package.', version='3.0.0'), dict(name='packageC', summary='Test package.', version='3.0.0'), ] alter_xmlrpc(value) redis.delete(POLL_SIMPLE_THROTTLE) assert ['packageC'] == update_package_list() expected = [ ('packageA', 'Test package.', '2.0.0'), ('packageB', 'Test package.', '3.0.0'), ('packageC', 'Test package.', '3.0.0'), ] actual = db.session.query(Package.name, Package.summary, Package.latest_version).all() assert expected == actual value = [ dict(name='packageA', summary='Test package.', version='2.0.0'), dict(name='packageC', summary='Test package.', version='3.0.0'), ] alter_xmlrpc(value) redis.delete(POLL_SIMPLE_THROTTLE) assert list() == update_package_list() expected = [ ('packageA', 'Test package.', '2.0.0'), ('packageB', 'Test package.', '3.0.0'), ('packageC', 'Test package.', '3.0.0'), ] actual = db.session.query(Package.name, Package.summary, Package.latest_version).all() assert expected == actual
def test_no_results(alter_xmlrpc): alter_xmlrpc(set()) redis.delete(POLL_SIMPLE_THROTTLE) assert list() == update_package_list()