当前位置: 首页>>代码示例>>Python>>正文


Python Controller.do_edit_sales方法代码示例

本文整理汇总了Python中Controller.Controller.do_edit_sales方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.do_edit_sales方法的具体用法?Python Controller.do_edit_sales怎么用?Python Controller.do_edit_sales使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller.Controller的用法示例。


在下文中一共展示了Controller.do_edit_sales方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_SelectedRecord_EditSales

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import do_edit_sales [as 别名]
    def test_SelectedRecord_EditSales(self):
        """
        A RecordCollection with one Record will be provided to Controller
        - Random ID, male, default attributes
        - Randomise a sales
        - Methodology for picking a new sales will be
           (original sales + 1) % 1000
        """
        theRC = self._getRecordColl_OneMaleRecord_RandomID()
        theRecord = theRC.getAllRecords()[0]
        theID = theRecord.getID()
        theRecord.setSales(random.randrange(1000))
        originalSales = theRecord.getSales()
        newSales = (originalSales + 1) % 1000  # 1000 is sales limit
        theController = Controller(TestView.TestView(), theRC)
        # From here the record will be manipulated via theController
        # Successful calls will represent the record via show message
        expected_1 = self._getRecordStateMessage(theID, sales=originalSales)
        expected_2 = self._getRecordStateMessage(theID, sales=newSales)

        # Call 1, selecting the record. 3 show messages
        expectedList = [TestObjectSelectionClass._expRecordHeader, expected_1,
                        TestObjectSelectionClass._expRecordFunctions]
        TestView.clearLog()
        theController.do_select_rec(theID)
        self.assertEqual(expectedList, TestView.theLog)

        # Call 2, editing the sales. 3 show messages
        expectedList[1] = expected_2
        TestView.clearLog()
        theController.do_edit_sales(newSales)
        self.assertEqual(expectedList, TestView.theLog)
开发者ID:acr79,项目名称:BCPR301_LegacySystem,代码行数:34,代码来源:UT_ObjectSelection.py

示例2: test_NoRecordSelected

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import do_edit_sales [as 别名]
 def test_NoRecordSelected(self):
     """
     This can be asserted by attempting to select an option
     - Regardless if the attempt works or not, one expected outcome is that
        no record will be selected
     """
     theController = Controller(TestView.TestView(), None)
     theController.do_select_option("")
     # For the method calls below, the main flow requires a record to be
     #  selected, therefore the alternative show message is expected
     expectedMessage = "No record selected"
     TestView.clearLog()
     theController.do_edit_age("")
     theController.do_edit_sales("")
     theController.do_edit_bmi("")
     theController.do_edit_income("")
     # 4 calls
     self.assertEqual(4, len(TestView.theLog))
     for actualMessage in TestView.theLog:
         self.assertEqual(expectedMessage, actualMessage)
开发者ID:acr79,项目名称:BCPR301_LegacySystem,代码行数:22,代码来源:UT_ObjectSelection.py


注:本文中的Controller.Controller.do_edit_sales方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。