Esempio n. 1
0
    def test_api_format_for_valid_box_package(self):
        height = 15.0
        width = 20.0
        depth = 35.0
        weight = 1.2

        package = BoxPackage()
        package.add_item(height, width, depth, weight)
        expected = {
            'nCdFormato': Package.FORMAT_BOX,
            'nVlAltura': height,
            'nVlLargura': width,
            'nVlComprimento': depth,
            'nVlPeso': weight
        }
        self.assertDictEqual(package.api_format(), expected)
Esempio n. 2
0
 def test_api_format_for_invalid_box_package(self):
     package = BoxPackage()
     package.add_item(100.0, 100.0, 100.0, 5.0)
     with self.assertRaises(Exception):
         package.api_format()