Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_has_no_processes_after_init(self):
p = environ.Procfile()
assert len(p.processes) == 0
def test_environ_parse(content, commands):
content = textwrap.dedent(content)
result = environ.parse(content)
assert result == commands
def printer(self): # noqa
self.p = FakePrinter()
self.m = Manager(printer=self.p)
self.m._env = FakeEnv()
def test_write_multiline(self):
out = FakeOutput()
p = Printer(output=out)
p.write(fake_message("one\ntwo\nthree\n"))
expect = "12:42:00 | one\n12:42:00 | two\n12:42:00 | three\n"
assert out.string() == expect
def test_write(self):
out = FakeOutput()
p = Printer(output=out)
p.write(fake_message("monkeys\n"))
assert out.string() == "12:42:00 | monkeys\n"
def test_write_with_set_width(self):
out = FakeOutput()
p = Printer(output=out, width=6)
p.write(fake_message("giraffe\n"))
assert out.string() == "12:42:00 | giraffe\n"
def test_write_with_name_and_set_width(self):
out = FakeOutput()
p = Printer(output=out, width=6)
p.write(fake_message("narcissist\n", name="oop"))
assert out.string() == "12:42:00 oop | narcissist\n"
def test_write_without_prefix_and_colour_tty(self):
out = FakeTTY()
p = Printer(output=out, prefix=False, colour=False)
p.write(fake_message("paranoid android\n", name="foo", colour="31"))
assert out.string() == "paranoid android\n"
def test_write_no_newline(self):
out = FakeOutput()
p = Printer(output=out)
p.write(fake_message("monkeys"))
assert out.string() == "12:42:00 | monkeys\n"
def test_write_wrong_type(self):
out = FakeOutput()
p = Printer(output=out)
with pytest.raises(RuntimeError):
p.write(fake_message("monkeys\n", type="error"))