Exemplo n.º 1
0
 def test_write_config(self, monkeypatch):
     fcontent = json.loads('{"123":"abc"}')
     mo = mock.mock_open()
     with mock.patch.object(builtins, 'open', mo):
         focli.write_config(fcontent)
     mo.assert_called_once_with(
         os.path.expanduser(focli.CONFIG_PATH), 'w')
Exemplo n.º 2
0
 def test_write_config_exception(self, monkeypatch):
     with mock.patch.object(builtins, 'open', mock.mock_open()):
         with pytest.raises(TypeError):
             focli.write_config(set())
Exemplo n.º 3
0
 def test_write_config(self, monkeypatch):
     fcontent = json.loads('{"123":"abc"}')
     mo = mock.mock_open()
     with mock.patch.object(builtins, 'open', mo):
         focli.write_config(fcontent)
     mo.assert_called_once_with(os.path.expanduser(focli.CONFIG_PATH), 'w')
Exemplo n.º 4
0
 def test_write_config_exception(self, monkeypatch):
     with mock.patch.object(builtins, 'open',
                            mock.mock_open()):
         with pytest.raises(TypeError):
             focli.write_config(set())