def test_get_latest_sequence_number(self):
        block3 = HalfBlock()
        block3.public_key = self.my_public_key3
        block3.sequence_number = 1

        block4 = HalfBlock()
        block4.public_key = self.my_public_key3
        block4.sequence_number = 2

        self.database.add_block(block3)
        self.database.add_block(block4)
        sequence_number = self.database.get_latest_sequence_number(
            public_key=self.my_public_key3)
        assert sequence_number == 2
    def test_get_blocks_since(self):
        block1 = HalfBlock()
        block1.public_key = self.my_public_key4
        block1.sequence_number = 1

        block2 = HalfBlock()
        block2.public_key = self.my_public_key4
        block2.sequence_number = 2

        self.database.add_block(block1)
        self.database.add_block(block2)
        blocks = self.database.get_blocks_since(sequence_number=2,
                                                public_key=self.my_public_key4)

        assert blocks[0].public_key == self.my_public_key4
        assert blocks[0].sequence_number == 2
 def test_get_blocks_by_public_key(self):
     block = HalfBlock()
     block.public_key = "haha"
     block.sequence_number = 80
     self.database.add_block(block)
     block_return = self.database.get_blocks_by_public_key(
         public_key="haha")
     assert block_return[0].public_key == "haha"
     assert block_return[0].sequence_number == 80