Esempio n. 1
0
    def test_with_parameters_returns_blob(self):
        from stickercode.stickergenerator import QL700Label
        filename = "ql700_label.png"
        touch_erase(filename)

        lbl = QL700Label(return_blob=True).return_blob()
    
        self.assertTrue(size_range(len(lbl), 16098, ok_range=500))
Esempio n. 2
0
    def test_submit_with_all_values_image_links_available(self):
        res = self.testapp.get("/")
        form = res.forms["deform"]
        form["serial"] = "ft789"
        form["domain"] = "https://functional.com"
        form.set("upload", Upload("resources/wasatch.png"), 0)
        submit_res = form.submit("submit")
        self.assertTrue("was a problem with" not in submit_res.body)

        top_link = "src=\"/show_label/ft789"
        self.assertTrue(top_link in submit_res.body)
 
        res = self.testapp.get("/show_label/ft789")
        img_size = res.content_length
        self.assertTrue(size_range(img_size, 15695, ok_range=5000))
Esempio n. 3
0
    def test_post_fully_populated_sticker_view_accessible(self):
        from stickercode.views import LabelViews

        post_dict = {"submit":"submit", "serial":"UT5555",
                     "domain":"https://waspho.com"}
        request = testing.DummyRequest(post_dict)
        inst = LabelViews(request)
        result = inst.qr_label()
       
        request = testing.DummyRequest()
        request.matchdict["serial"] = "UT5555"
        inst = LabelViews(request)
        result = inst.show_label()

        file_size = result.content_length
        self.assertTrue(size_range(file_size, 15118))