Beispiel #1
0
 def test_it_should_remove_the_pending_relationship_if_you_block_someone(
         self):
     amico = Amico(
         options={
             'pending_follow': True},
         redis_connection=self.redis_connection)
     amico.follow(11, 1)
     amico.is_pending(11, 1).should.be.true
     amico.is_pending_with(1, 11).should.be.true
     amico.block(1, 11)
     amico.is_pending(11, 1).should.be.false
     amico.is_pending_with(1, 11).should.be.false
     amico.is_blocked(1, 11).should.be.true
Beispiel #2
0
    def test_it_should_remove_the_pending_relationship_without_following_or_blocking(
            self):
        amico = Amico(
            options={
                'pending_follow': True},
            redis_connection=self.redis_connection)
        amico.follow(1, 11)
        amico.is_pending(1, 11).should.be.true
        amico.is_pending_with(11, 1).should.be.true

        amico.deny(1, 11)

        amico.is_following(1, 11).should.be.false
        amico.is_pending(1, 11).should.be.false
        amico.is_pending_with(11, 1).should.be.false
        amico.is_blocked(1, 11).should.be.false
Beispiel #3
0
 def test_it_should_allow_you_to_block_someone_you_have_blocked(self):
     amico = Amico(redis_connection=self.redis_connection)
     amico.block(1, 11)
     amico.is_blocked(1, 11).should.be.true
     amico.redis_connection.zcard(
         '%s:%s:%s:%s' %
         (Amico.DEFAULTS['namespace'],
          Amico.DEFAULTS['blocked_by_key'],
          Amico.DEFAULTS['default_scope_key'],
          11)).should.equal(1)
     amico.unblock(1, 11)
     amico.is_blocked(1, 11).should.be.false
     amico.redis_connection.zcard(
         '%s:%s:%s:%s' %
         (Amico.DEFAULTS['namespace'],
          Amico.DEFAULTS['blocked_by_key'],
          Amico.DEFAULTS['default_scope_key'],
          11)).should.equal(0)
Beispiel #4
0
 def test_it_should_return_that_someone_is_being_blocked(self):
     amico = Amico(redis_connection=self.redis_connection)
     amico.block(1, 11)
     amico.is_blocked(1, 11).should.be.true
     amico.is_following(11, 1).should.be.false
Beispiel #5
0
    def test_it_should_not_allow_you_to_block_yourself(self):
        amico = Amico(redis_connection=self.redis_connection)
        amico.block(1, 1)

        amico.is_blocked(1, 1).should.be.false