Beispiel #1
0
    def test_fetch_listings_existing_users(self, process_listings):
        """Should add to existing sets of users."""
        r.sadd('listings.1.users', '9', '10', 'three')

        fetch_listings()

        assert r.smembers('listings.1.users') == set(['9', '10', 'three', '1'])
Beispiel #2
0
    def test_fetch_listings_duplicate_user_no_fetch(self, process_listings):
        """Should not fetch the listing if only one unique user ID is found."""
        r.sadd('listings.1.users', '1')

        fetch_listings()

        assert r.smembers('listings.1.users') == set(['1'])
        assert '1' not in process_listings.call_args[0]
Beispiel #3
0
    def test_fetch_listings_single_new_user(self, process_listings):
        """Should fetch existing items with a single new user."""
        r.sadd('listings.1.users', '9')

        fetch_listings()

        assert r.smembers('listings.1.users') == set(['1', '9'])
        assert '1' in process_listings.call_args[0]
Beispiel #4
0
    def test_fetch_listings_multiple_users(self, process_listings):
        """Should store user IDs and fetch items with more than one user."""
        fetch_listings()

        assert r.smembers('listings.2.users') == set(['1', '2'])
        assert '2' in process_listings.call_args[0]
Beispiel #5
0
    def test_fetch_listings_single_user(self, process_listings):
        """Should store user IDs but not fetch items with one user."""
        fetch_listings()

        assert r.smembers('listings.1.users') == set(['1'])
        assert '1' not in process_listings.call_args[0]