def test_get_options_fails_when_no_url(self, mock_stdout):
     get_options([
         '-k', 'MY-SECURITY-KEY',
         '-w', '200',
         '-e', '300',
     ])
     expect(mock_stdout.getvalue()).to_equal(
         'Error: The image argument is mandatory. For more information type thumbor-url -h\n'
     )
 def test_get_options_fails_when_no_url(self, mock_stdout):
     get_options([
         '-k', 'MY-SECURITY-KEY',
         '-w', '200',
         '-e', '300',
     ])
     expect(mock_stdout.getvalue()).to_equal(
         'Error: The image argument is mandatory. For more information type thumbor-url -h\n'
     )
Beispiel #3
0
    def test_get_options(self):
        options, args = get_options([
            '-k', 'MY-SECURITY-KEY', '-w', '200', '-e', '300',
            'myserver.com/myimg.jpg'
        ])

        expect(options.key).to_equal('MY-SECURITY-KEY')
        expect(options.width).to_equal(200)
        expect(options.height).to_equal(300)

        expect(args).to_length(1)
        expect(args[0]).to_equal('myserver.com/myimg.jpg')
    def test_get_options(self):
        options, args = get_options([
            '-k', 'MY-SECURITY-KEY',
            '-w', '200',
            '-e', '300',
            'myserver.com/myimg.jpg'
        ])

        expect(options.key).to_equal('MY-SECURITY-KEY')
        expect(options.width).to_equal(200)
        expect(options.height).to_equal(300)

        expect(args).to_length(1)
        expect(args[0]).to_equal('myserver.com/myimg.jpg')
Beispiel #5
0
    def test_get_options_from_sys(self):
        argv = [
            'thumbor-url', '-k', 'MY-SECURITY-KEY', '-w', '200', '-e', '300',
            'myserver.com/myimg.jpg'
        ]
        with mock.patch.object(sys, 'argv', argv):
            options, args = get_options(None)

        expect(options.key).to_equal('MY-SECURITY-KEY')
        expect(options.width).to_equal(200)
        expect(options.height).to_equal(300)

        expect(args).to_length(1)
        expect(args[0]).to_equal('myserver.com/myimg.jpg')
Beispiel #6
0
    def test_get_options(self):
        options, args = get_options([
            "-k",
            "MY-SECURITY-KEY",
            "-w",
            "200",
            "-e",
            "300",
            "myserver.com/myimg.jpg",
        ])

        expect(options.key).to_equal("MY-SECURITY-KEY")
        expect(options.width).to_equal(200)
        expect(options.height).to_equal(300)

        expect(args).to_length(1)
        expect(args[0]).to_equal("myserver.com/myimg.jpg")
    def test_get_options_from_sys(self):
        argv = [
            'thumbor-url',
            '-k', 'MY-SECURITY-KEY',
            '-w', '200',
            '-e', '300',
            'myserver.com/myimg.jpg'
        ]
        with mock.patch.object(sys, 'argv', argv):
            options, args = get_options(None)

        expect(options.key).to_equal('MY-SECURITY-KEY')
        expect(options.width).to_equal(200)
        expect(options.height).to_equal(300)

        expect(args).to_length(1)
        expect(args[0]).to_equal('myserver.com/myimg.jpg')
Beispiel #8
0
    def test_get_options_from_sys(self):
        argv = [
            "thumbor-url",
            "-k",
            "MY-SECURITY-KEY",
            "-w",
            "200",
            "-e",
            "300",
            "myserver.com/myimg.jpg",
        ]
        with mock.patch.object(sys, "argv", argv):
            options, args = get_options(None)

        expect(options.key).to_equal("MY-SECURITY-KEY")
        expect(options.width).to_equal(200)
        expect(options.height).to_equal(300)

        expect(args).to_length(1)
        expect(args[0]).to_equal("myserver.com/myimg.jpg")
Beispiel #9
0
 def test_get_options_fails_when_no_url(self):
     parsed_options, arguments = get_options(
         ["-k", "MY-SECURITY-KEY", "-w", "200", "-e", "300"])
     expect(parsed_options).to_be_null()
     expect(arguments).to_be_null()