Python SQLAlchemy - Mocking a model attribute's “desc” method

后端 未结 2 1619
悲&欢浪女
悲&欢浪女 2021-02-01 10:50

In my application, there is a class for each model that holds commonly used queries (I guess it\'s somewhat of a \"Repository\" in DDD language). Each of these classes is passed

2条回答
  •  猫巷女王i
    2021-02-01 11:34

    If yet you want to create a unit test with mock input, you can create instances of your model with fake data

    In case that the result proxy return result with data from more than one of the models (for instance when you join two tables), you can use collections data struct called namedtuple

    We are using it to mock results of join queries

提交回复
热议问题