def testSliceSimpleAsciiStlField(): fields = [('stl', testtools.dataFile('trivial_ascii.stl'))] response = testtools.postRequest(baseurl + '/slice', fields=fields) testtools.assertEqual(response.status_code, 200) r = response.read() lines = r.split('\n') assert len(lines) > 1000 assert lines[0].startswith('M109 T0')
def testSliceSimpleAsciiStlField(): fields = [ ('stl', testtools.dataFile('trivial_ascii.stl')) ] response = testtools.postRequest(baseurl+'/slice', fields=fields) testtools.assertEqual(response.status_code, 200) r = response.read() lines = r.split('\n') assert len(lines) > 1000 assert lines[0].startswith('M109 T0')
def testSliceInvalidStlFile(): files = [('stl', 'invalid.stl', testtools.dataFile('invalid.stl'))] response = testtools.postRequest(baseurl + '/slice', files) testtools.assertEqual(response.status_code, 400) content_type = testtools.getHeader(response, 'content-type') testtools.assertEqual(content_type, 'application/json') res = json.loads(response.read()) assert res['error'] assert len(res['error']) > 10
def testSliceInvalidStlFile(): files = [ ('stl', 'invalid.stl', testtools.dataFile('invalid.stl')) ] response = testtools.postRequest(baseurl+'/slice', files) testtools.assertEqual(response.status_code, 400) content_type = testtools.getHeader(response, 'content-type') testtools.assertEqual(content_type, 'application/json') res = json.loads(response.read()) assert res['error'] assert len(res['error']) > 10
def testPreviewSimpleAsciiStlField(): fields = [ ('stl', testtools.dataFile('trivial_ascii.stl')) ] response = testtools.postRequest(baseurl+'/preview', fields=fields) testtools.assertEqual(response.status_code, 200) r = json.loads(response.read()) assert r['gcode'].startswith('M109 T0') assert len(r['polygons']) == 198 assert r['polygons'][0].keys() == [u'openoutline', u'inset0', u'skirt', u'insetx', u'skin'] assert r['filamentUse'] == '0.48 meter 4 gram' assert r['printTime'] == '28 minutes'
def testPreviewSimpleAsciiStlField(): fields = [('stl', testtools.dataFile('trivial_ascii.stl'))] response = testtools.postRequest(baseurl + '/preview', fields=fields) testtools.assertEqual(response.status_code, 200) r = json.loads(response.read()) assert r['gcode'].startswith('M109 T0') assert len(r['polygons']) == 198 assert r['polygons'][0].keys() == [ u'openoutline', u'inset0', u'skirt', u'insetx', u'skin' ] assert r['filamentUse'] == '0.48 meter 4 gram' assert r['printTime'] == '28 minutes'