@@ -0,0 +1,1634 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Aimport sys%0A%0Aimport pretend%0Aimport pytest%0A%0Afrom fenrir import __main__%0A%0A%0A@pytest.mark.parametrize(%0A    (%22argv%22, %22options%22),%0A    %5B%0A        (%5B%22example:app%22%5D, (%5B%22example:app%22%5D, %7B%22bind%22: None%7D)),%0A        (%0A            %5B%22example:app%22, %22-b%22, %220.0.0.0:5000%22%5D,%0A            (%5B%22example:app%22%5D, %7B%22bind%22: %5B%220.0.0.0:5000%22%5D%7D),%0A        ),%0A    %5D,%0A)%0Adef test_main(argv, options, monkeypatch):%0A    server_obj = pretend.stub(spawn=pretend.call_recorder(lambda: None))%0A    server_cls = pretend.call_recorder(lambda *a, **kw: server_obj)%0A%0A    monkeypatch.setattr(__main__, %22Server%22, server_cls)%0A%0A    __main__.main(argv)%0A%0A    assert server_cls.calls == %5Bpretend.call(*options%5B0%5D, **options%5B1%5D)%5D%0A    assert server_obj.spawn.calls == %5Bpretend.call()%5D%0A%0A%0Adef test_entrypoint(monkeypatch):%0A    exitcode = pretend.stub()%0A    main = pretend.call_recorder(lambda argv: exitcode)%0A    argv = %5B%22fenrir%22, %22-b%22, %220.0.0.0:8000%22%5D%0A%0A    monkeypatch.setattr(__main__, %22main%22, main)%0A    monkeypatch.setattr(sys, %22argv%22, argv)%0A%0A    assert __main__.entrypoint() is exitcode%0A    assert main.calls == %5Bpretend.call(%5B%22-b%22, %220.0.0.0:8000%22%5D)%5D%0A

Test the CLI interface of fenrir