Here are the examples of the python api rmoq.Mock taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
11 Examples
3
Example 1
Project: feedhuddler Source File: test_commands.py
@pytest.mark.django_db
def test_delete_old_feeds_should_delete_feed_without_subscriptions():
with rmoq.Mock('rmoq'):
Feed.objects.create(pk=1, url='http://rolflekang.com/feed.xml')
call_command('delete_old_feeds')
assert not Feed.objects.filter(url='http://rolflekang.com/feed.xml').exists()
3
Example 2
Project: feedhuddler Source File: test_commands.py
@pytest.mark.django_db
def test_delete_old_feeds_should_not_delete_feed_with_subscriptions():
with rmoq.Mock('rmoq'):
feed = Feed.objects.create(pk=1, url='http://rolflekang.com/feed.xml')
Subscription.objects.create(feed=feed, user_id=1)
call_command('delete_old_feeds')
assert Feed.objects.filter(url='http://rolflekang.com/feed.xml').exists()
3
Example 3
Project: feedhuddler Source File: test_managers.py
@pytest.mark.django_db
def test_create_from_entry_rss(rss):
with rmoq.Mock('rmoq'):
docuement = feedparser.parse(requests.get(rss.url).text).entries[0]
item, c = FeedItem.objects.create_from_entry(docuement, rss)
assert item.pub_date is not None
assert item.pub_date.timetuple() == docuement['published_parsed']
assert item.title == docuement['title']
3
Example 4
Project: feedhuddler Source File: test_managers.py
@pytest.mark.django_db
def test_create_from_entry_atom(atom):
with rmoq.Mock('rmoq'):
docuement = feedparser.parse(requests.get(atom.url).text).entries[0]
item, c = FeedItem.objects.create_from_entry(docuement, atom)
assert item.pub_date is not None
assert item.pub_date.timetuple() == docuement['published_parsed']
assert item.title == docuement['title']
0
Example 5
Project: feedhuddler Source File: test_helpers.py
def test_find_feed_url_is_feed(mocker):
mocker.patch('feedpocket.feeds.models.Feed.find_existing_url', return_value=None)
with rmoq.Mock('rmoq'):
assert helpers\
.find_feed('http://rolflekang.com/feed.xml') == 'http://rolflekang.com/feed.xml'
0
Example 6
Project: feedhuddler Source File: test_helpers.py
def test_site_with_rss_feed(mocker):
mocker.patch('feedpocket.feeds.models.Feed.find_existing_url', return_value=None)
with rmoq.Mock('rmoq'):
assert helpers.find_feed('http://rolflekang.com') == 'http://rolflekang.com/feed.xml'
0
Example 7
Project: feedhuddler Source File: test_helpers.py
def test_site_with_atom_feed(mocker):
mocker.patch('feedpocket.feeds.models.Feed.find_existing_url', return_value=None)
with rmoq.Mock('rmoq'):
assert helpers.find_feed('http://zachholman.com') == 'http://zachholman.com/atom.xml'
0
Example 8
Project: feedhuddler Source File: test_helpers.py
def test_site_with_relative_path_to_feed(mocker):
mocker.patch('feedpocket.feeds.models.Feed.find_existing_url', return_value=None)
with rmoq.Mock('rmoq'):
assert helpers.find_feed('http://lucuemr.pocoo.org/') == 'http://lucuemr.pocoo.org/feed.atom'
0
Example 9
Project: feedhuddler Source File: test_helpers.py
def test_site_with_no_feed(mocker):
mocker.patch('feedpocket.feeds.models.Feed.find_existing_url', return_value=None)
with rmoq.Mock('rmoq'):
assert helpers.find_feed('http://google.com') is None
0
Example 10
@pytest.fixture
def rss():
with rmoq.Mock('rmoq'):
return Feed.objects.create(url='http://andersmakes.wordpress.com/feed/')
0
Example 11
@pytest.fixture
def atom():
with rmoq.Mock('rmoq'):
return Feed.objects.create(url='http://rolflekang.com/feed.xml')