示例#1
0
    def it_is_identified_by_a_unique_code(self):
        assert_equal(self.p.code, self.p.id)

        assert_equal(Product.objects(code=self.code).count(), 1)
        create_product(code=self.code)
        assert_equal(Product.objects(code=self.code).count(), 1)
        assert_raises(db.OperationError, create_product, code=self.code, force_insert=True)