示例#1
0
 def test_should_read_connection(self):
     with NamedTemporaryFile(suffix=".env") as tmp_file:
         tmp_file.write(b"CONN_A=mysql://host_a")
         tmp_file.flush()
         backend = LocalFilesystemBackend(
             connections_file_path=tmp_file.name)
         assert ["mysql://host_a"] == [
             conn.get_uri() for conn in backend.get_connections("CONN_A")
         ]
         assert backend.get_variable("CONN_B") is None
 def test_should_read_connection(self):
     with NamedTemporaryFile(suffix=".env") as tmp_file:
         tmp_file.write("CONN_A=mysql://host_a\nCONN_A=mysql://host_b".encode())
         tmp_file.flush()
         backend = LocalFilesystemBackend(connections_file_path=tmp_file.name)
         self.assertEqual(
             ["mysql://host_a", "mysql://host_b"],
             [conn.get_uri() for conn in backend.get_connections("CONN_A")],
         )
         self.assertIsNone(backend.get_variable("CONN_B"))
 def test_files_are_optional(self):
     backend = LocalFilesystemBackend()
     self.assertEqual([], backend.get_connections("CONN_A"))
     self.assertIsNone(backend.get_variable("VAR_A"))
示例#4
0
 def test_files_are_optional(self):
     backend = LocalFilesystemBackend()
     assert [] == backend.get_connections("CONN_A")
     assert backend.get_variable("VAR_A") is None