This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from grigouze/tests_domain
Add tests domain
- Loading branch information
Showing
5 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |