basic stfpd setup test

This commit is contained in:
meejah 2018-03-01 16:38:42 -07:00
parent dd2209a96c
commit abd7b638b8

View File

@ -2,6 +2,7 @@ import os, sys
import twisted import twisted
from twisted.trial import unittest from twisted.trial import unittest
from twisted.application import service from twisted.application import service
import mock
import allmydata import allmydata
import allmydata.frontends.magic_folder import allmydata.frontends.magic_folder
@ -242,6 +243,21 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test
# TODO: also test config options for SFTP. # TODO: also test config options for SFTP.
def test_ftp_create(self):
basedir = u"client.Basic.test_ftp_create"
create_node_dir(basedir, "testing")
with open(os.path.join(basedir, "tahoe.cfg"), "w") as f:
f.write(
'[sftpd]\n'
'enabled = true\n'
'accounts.file = foo\n'
'host_pubkey_file = pubkey\n'
'host_privkey_file = privkey\n'
)
with mock.patch('allmydata.frontends.sftpd.SFTPServer') as p:
c = client.create_client(basedir)
self.assertTrue(p.called)
def test_ftp_auth_keyfile(self): def test_ftp_auth_keyfile(self):
basedir = u"client.Basic.test_ftp_auth_keyfile" basedir = u"client.Basic.test_ftp_auth_keyfile"
os.mkdir(basedir) os.mkdir(basedir)