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

        lbl = QL700Label()
        self.assertTrue(file_range(filename, 16098, ok_range=1000))
Exemplo n.º 2
0
    def test_post_fully_populated_creates_hardcoded_filename(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()
        
        dest_file = "label_files/ut5555/label.png"
        self.assertTrue(file_range(dest_file, 15118))
Exemplo n.º 3
0
    def test_post_with_image_creates_hardcoded_filename(self):
        from stickercode.views import LabelViews
    
        png_name = "resources/inverted_wasatch.png"
        png_file = DeformMockFieldStorage(png_name)
        png_upload_dict = {"upload":png_file}
 
        post_dict = {"submit":"submit", "serial":"UT5555",
                     "domain":"https://waspho.com",
                     "upload":png_upload_dict}
        request = testing.DummyRequest(post_dict)
        inst = LabelViews(request)
        result = inst.qr_label()
        
        dest_top = "label_files/ut5555/custom_background.png"
        self.assertTrue(file_range(dest_top, 63692))
Exemplo n.º 4
0
    def test_post_with_invalid_background_size_uses_default(self):
        from stickercode.views import LabelViews
        
    
        png_name = "resources/wrong_size_wasatch.png"
        png_file = DeformMockFieldStorage(png_name)
        png_upload_dict = {"upload":png_file}
 
        post_dict = {"submit":"submit", "serial":"UT5555",
                     "domain":"https://waspho.com",
                     "upload":png_upload_dict}

        request = testing.DummyRequest(post_dict)
        inst = LabelViews(request)
        result = inst.qr_label()

        dest_file = "label_files/ut5555/label.png"
        self.assertTrue(file_range(dest_file, 15118))
Exemplo n.º 5
0
 def test_file_sizes_out_of_range(self):
     filename = "stickercode/assets/img/example_qr_label.png"
     # Too small with default range 50
     self.assertFalse(file_range(filename, 30000))
     # Too big
     self.assertFalse(file_range(filename, 33000))
Exemplo n.º 6
0
 def test_file_does_not_exist(self):
     filename = "known_unknown_file"
     self.assertFalse(file_range(filename, 10000))