mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-02 03:06:41 +00:00
Sleepy time WIP almost got invite's mkdir working...
This commit is contained in:
parent
331dd8bd9d
commit
bf34685ae0
@ -3,7 +3,8 @@ import os
|
|||||||
|
|
||||||
from twisted.python import usage, failure
|
from twisted.python import usage, failure
|
||||||
from allmydata.scripts.common import BaseOptions
|
from allmydata.scripts.common import BaseOptions
|
||||||
from .common import BaseOptions, BasedirOptions
|
from .common import BaseOptions, BasedirOptions, get_aliases
|
||||||
|
from .cli import MakeDirectoryOptions
|
||||||
|
|
||||||
class CreateOptions(BasedirOptions):
|
class CreateOptions(BasedirOptions):
|
||||||
nickname = None
|
nickname = None
|
||||||
@ -25,10 +26,32 @@ def create(options):
|
|||||||
return rc
|
return rc
|
||||||
|
|
||||||
class InviteOptions(BasedirOptions):
|
class InviteOptions(BasedirOptions):
|
||||||
pass
|
nickname = None
|
||||||
|
synopsis = "MAGIC_ALIAS: NICKNAME"
|
||||||
|
def parseArgs(self, alias, nickname=None):
|
||||||
|
BasedirOptions.parseArgs(self)
|
||||||
|
print "InviteOptions parseArgs() alias %s nickname %s" % (alias, nickname,)
|
||||||
|
self.alias = alias
|
||||||
|
self.nickname = nickname
|
||||||
|
node_url_file = os.path.join(self['node-directory'], "node.url")
|
||||||
|
self['node-url'] = open(node_url_file, "r").read().strip()
|
||||||
|
|
||||||
|
aliases = get_aliases(self['node-directory'])
|
||||||
|
print "ALIASES %s" % (aliases,)
|
||||||
|
self.aliases = aliases
|
||||||
|
|
||||||
def invite(options):
|
def invite(options):
|
||||||
pass
|
from allmydata.scripts import tahoe_mkdir
|
||||||
|
mkdirOptions = MakeDirectoryOptions()
|
||||||
|
mkdirOptions.where = options.nickname
|
||||||
|
mkdirOptions.stdout = options.stdout
|
||||||
|
mkdirOptions.stdin = options.stdin
|
||||||
|
mkdirOptions.stderr = options.stderr
|
||||||
|
mkdirOptions['node-url'] = options['node-url']
|
||||||
|
mkdirOptions.aliases = options.aliases
|
||||||
|
mkdirOptions['node-directory'] = options['node-directory']
|
||||||
|
rc = tahoe_mkdir.mkdir(mkdirOptions)
|
||||||
|
return rc
|
||||||
|
|
||||||
class JoinOptions(BasedirOptions):
|
class JoinOptions(BasedirOptions):
|
||||||
pass
|
pass
|
||||||
|
@ -13,10 +13,7 @@ from .test_cli import CLITestMixin
|
|||||||
|
|
||||||
class CreateMagicFolder(GridTestMixin, CLITestMixin, unittest.TestCase):
|
class CreateMagicFolder(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||||
|
|
||||||
def test_create(self):
|
def _create_magic_folder(self):
|
||||||
self.basedir = "cli/MagicFolder/create"
|
|
||||||
self.set_up_grid()
|
|
||||||
|
|
||||||
d = self.do_cli("magic-folder", "create", "my_magic_folder")
|
d = self.do_cli("magic-folder", "create", "my_magic_folder")
|
||||||
def _done((rc,stdout,stderr)):
|
def _done((rc,stdout,stderr)):
|
||||||
self.failUnless("Alias 'my_magic_folder' created" in stdout)
|
self.failUnless("Alias 'my_magic_folder' created" in stdout)
|
||||||
@ -26,4 +23,19 @@ class CreateMagicFolder(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
self.failUnless(aliases["my_magic_folder"].startswith("URI:DIR2:"))
|
self.failUnless(aliases["my_magic_folder"].startswith("URI:DIR2:"))
|
||||||
d.addCallback(_done)
|
d.addCallback(_done)
|
||||||
return d
|
return d
|
||||||
# XXX more stuff ...
|
|
||||||
|
def test_create(self):
|
||||||
|
self.basedir = "cli/MagicFolder/create"
|
||||||
|
self.set_up_grid()
|
||||||
|
return self._create_magic_folder()
|
||||||
|
|
||||||
|
def _invite(self, ignore):
|
||||||
|
d = self.do_cli("magic-folder", "invite", "magicFolder1", "Nicki")
|
||||||
|
return d
|
||||||
|
|
||||||
|
def test_invite(self):
|
||||||
|
self.basedir = "cli/MagicFolder/invite"
|
||||||
|
self.set_up_grid()
|
||||||
|
d = self._create_magic_folder()
|
||||||
|
d.addCallback(self._invite)
|
||||||
|
return d
|
||||||
|
Loading…
Reference in New Issue
Block a user