Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge ed0ed8e into 11e3912
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigouze committed Mar 31, 2015
2 parents 11e3912 + ed0ed8e commit 3fe3969
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 8 deletions.
Empty file removed gandi/cli/tests/case.py
Empty file.
11 changes: 7 additions & 4 deletions gandi/cli/tests/commands/test_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class CertTestCase(CommandTestCase):

def test_packages(self):

result = self.runner.invoke(certificate.packages, [])
result = self.runner.invoke(certificate.packages, [],
catch_exceptions=False)

#self.assertEqual(result.exit_code, 0)
wanted = (
Expand Down Expand Up @@ -41,7 +42,8 @@ def test_packages(self):

def test_list(self):

result = self.runner.invoke(certificate.list, [])
result = self.runner.invoke(certificate.list, [],
catch_exceptions=False)

self.assertEqual(result.output, """cn : mydomain.name
plan : Standard Single Domain
Expand All @@ -53,7 +55,8 @@ def test_list(self):

def test_info(self):

result = self.runner.invoke(certificate.info, ['inter.net'])
result = self.runner.invoke(certificate.info, ['inter.net'],
catch_exceptions=False)

self.assertEqual(result.output, """cn : inter.net
date_created : 20140904T14:06:26
Expand Down Expand Up @@ -84,7 +87,7 @@ def test_create(self):
['--csr', csr,
'--duration', 5,
'--max-altname', '5',
])
], catch_exceptions=False)

wanted = '''The certificate create operation is 1
You can follow it with:
Expand Down
11 changes: 7 additions & 4 deletions gandi/cli/tests/commands/test_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DiskTestCase(CommandTestCase):

def test_list(self):

result = self.runner.invoke(disk.list, [])
result = self.runner.invoke(disk.list, [], catch_exceptions=False)

self.assertEqual(result.output, """name : data
state : created
Expand All @@ -28,7 +28,8 @@ def test_list(self):
self.assertEqual(result.exit_code, 0)

def test_info(self):
result = self.runner.invoke(disk.info, ['arch64'])
result = self.runner.invoke(disk.info, ['arch64'],
catch_exceptions=False)

self.assertEqual(result.output, """name : arch64
state : created
Expand All @@ -47,14 +48,16 @@ def test_check_size(self):
self.assertRaises(ClickException, disk_check_size, None, None, 2040)

def __test_detach(self):
result = self.runner.invoke(disk.detach, ['data'])
result = self.runner.invoke(disk.detach, ['data'],
catch_exceptions=False)
self.assertEqual(result.output.strip(),
"Are you sure to detach data? [y/N]:"
)
self.assertEqual(result.exit_code, 0)

def test_detach_forced(self):
result = self.runner.invoke(disk.detach, ['-f', 'data'])
result = self.runner.invoke(disk.detach, ['-f', 'data'],
catch_exceptions=False)
self.assertEqual(re.sub(r'\[#+\]', '[###]',
result.output.strip()), """\
The disk is still attached to the vm 80458.
Expand Down
31 changes: 31 additions & 0 deletions gandi/cli/tests/commands/test_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from .base import CommandTestCase
from gandi.cli.commands import domain


class DomainTestCase(CommandTestCase):

def test_list(self):

result = self.runner.invoke(domain.list, [], catch_exceptions=False)

self.assertEqual(result.output, """iheartcli.com
cli.sexy
""")
self.assertEqual(result.exit_code, 0)

def test_info(self):
result = self.runner.invoke(domain.info, ['iheartcli.com'],
catch_exceptions=False)

self.assertEqual(result.output, """owner : AA1-GANDI
admin : AA2-GANDI
bill : AA3-GANDI
tech : AA5-GANDI
reseller : AA4-GANDI
fqdn : iheartcli.com
nameservers : ['a.dns.gandi.net', 'b.dns.gandi.net', 'c.dns.gandi.net']
services : ['gandidns']
zone_id : 424242
tags : bla
""")
self.assertEqual(result.exit_code, 0)
29 changes: 29 additions & 0 deletions gandi/cli/tests/fixtures/_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
def list(options):
return [{'fqdn': 'iheartcli.com',
'nameservers': ['a.dns.gandi.net', 'b.dns.gandi.net',
'c.dns.gandi.net'],
'services': ['gandidns'],
'zone_id': 424242,
'tags': 'bla',
'contacts': {'owner': {'handle': 'AA1-GANDI'},
'admin': {'handle': 'AA2-GANDI'},
'bill': {'handle': 'AA3-GANDI'},
'reseller': {'handle': 'AA4-GANDI'},
'tech': {'handle': 'AA5-GANDI'}}},
{'fqdn': 'cli.sexy',
'nameservers': ['a.dns.gandi.net', 'b.dns.gandi.net',
'c.dns.gandi.net'],
'services': ['gandidns'],
'zone_id': 424242,
'tags': 'bli',
'contacts': {'owner': {'handle': 'AA1-GANDI'},
'admin': {'handle': 'AA2-GANDI'},
'bill': {'handle': 'AA3-GANDI'},
'reseller': {'handle': 'AA4-GANDI'},
'tech': {'handle': 'AA5-GANDI'}}},
]


def info(id):
domain = dict([(domain['fqdn'], domain) for domain in list({})])
return domain[id]

0 comments on commit 3fe3969

Please sign in to comment.