Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update module import

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>
  • Loading branch information...
commit 55c5d3d77f7627c30d9274a7df64cfaea40036c9 1 parent 9323463
@mkouhei authored
View
2  src/tonicdnscli/command.py
@@ -34,7 +34,7 @@ def checkInfile(filename):
# action: True is for PUT/POST HTTP method
# False is for DELETE HTTP method
def setJSON(domain, action, filename=False, record=False):
- import converter
+ import tonicdnscli.converter as converter
o = converter.JSONConvert(domain)
# for 'bulk_create/bulk_delete'
View
2  src/tonicdnscli/connect.py
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-from __init__ import __timeout__
+from tonicdnscli.__init__ import __timeout__
def tonicDNSClient(uri, method, token='', data='', keyword='', domain=''):
View
2  src/tonicdnscli/processing.py
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-import connect as conn
+import tonicdnscli.connect as conn
def unprovide():
View
36 src/tonicdnscli/tests/test_connect.py
@@ -7,16 +7,20 @@
import unittest
from minimock import mock, Mock, restore
import tonicdnscli.connect as conn
+import sys
+if sys.version_info > (2, 6) and sys.version_info < (2, 8):
+ import StringIO as io
+elif sys.version_info > (3, 0):
+ import io as io
+
+if sys.version_info > (2, 6) and sys.version_info < (2, 8):
+ import urllib2 as urllib
+elif sys.version_info > (3, 0):
+ import urllib.request as urllib
class connectTests(unittest.TestCase):
def setUp(self):
- import sys
- from StringIO import StringIO
- if sys.version_info > (2, 6) and sys.version_info < (2, 8):
- import urllib2 as urllib
- elif sys.version_info > (3, 0):
- import urllib.request as urllib
self.datajson = '''{"name": "example.org", "type": "MASTER",
"notified_serial": "2012042701",
@@ -35,12 +39,12 @@ def setUp(self):
"ttl": "86400", "priority": False, "change_date":"1328449038"}]}
urllib.build_opener = Mock('build_opener',
- returns=Mock('opener',
- open=Mock('opener.open',
- returns=Mock('opener.open',
- read=Mock('opener.open.read',
- returns=self.datajson)))))
-
+ returns=Mock('opener',
+ open=Mock('opener.open',
+ returns=Mock('opener.open',
+ read=Mock('opener.open.read',
+ returns=self.datajson)))))
+
self.uri = 'https://ns.example.org'
self.token = 'efb9fc406a15bf9bdc60f52b36c14bcc6a1fd041'
self.data = ''
@@ -49,9 +53,7 @@ def tearDown(self):
restore()
def test_tonicDNSClient(self):
- import sys
- import StringIO
- dumpout = StringIO.StringIO()
+ dumpout = io.StringIO()
ostdout = sys.stdout
sys.stdout = dumpout
uri = self.uri + '/zone/example.org'
@@ -62,9 +64,7 @@ def test_tonicDNSClient(self):
self.assert_(dumpout.getvalue())
def test_formattedPrint(self):
- import sys
- import StringIO
- dumpout = StringIO.StringIO()
+ dumpout = io.StringIO()
ostdout = sys.stdout
sys.stdout = dumpout
conn.formattedPrint(self.datadict)
View
4 src/tonicdnscli/tests/test_pep8.py
@@ -35,5 +35,5 @@ def test_pep8():
errors = pep8.get_count('E')
warnings = pep8.get_count('W')
message = 'pep8: %d errors / %d warnings' % (errors, warnings)
- print message
- assert errors + warnings == 0, message
+ print(message)
+ assert(errors + warnings == 0, message)
View
15 src/tonicdnscli/tests/test_processing.py
@@ -6,7 +6,10 @@
"""
import unittest
import sys
-import StringIO
+if sys.version_info > (2, 6) and sys.version_info < (2, 8):
+ import StringIO as io
+elif sys.version_info > (3, 0):
+ import io as io
from mock import Mock
import tonicdnscli.connect as conn
import tonicdnscli.processing as p
@@ -58,7 +61,7 @@ def setUp(self):
def test_createRecords(self):
conn.tonicDNSClient = Mock(return_value='true')
- dumpout = StringIO.StringIO()
+ dumpout = io.StringIO()
ostdout = sys.stdout
sys.stdout = dumpout
print(conn.tonicDNSClient())
@@ -70,7 +73,7 @@ def test_createRecords(self):
def test_deleteRecords(self):
conn.tonicDNSClient = Mock(return_value='true')
- dumpout = StringIO.StringIO()
+ dumpout = io.StringIO()
ostdout = sys.stdout
sys.stdout = dumpout
print(conn.tonicDNSClient())
@@ -82,7 +85,7 @@ def test_deleteRecords(self):
def test_createTemplate(self):
conn.tonicDNSClient = Mock(return_value='true')
- dumpout = StringIO.StringIO()
+ dumpout = io.StringIO()
ostdout = sys.stdout
sys.stdout = dumpout
print(conn.tonicDNSClient())
@@ -95,7 +98,7 @@ def test_createTemplate(self):
def test_updateTemplate(self):
conn.tonicDNSClient = Mock(return_value='true')
- dumpout = StringIO.StringIO()
+ dumpout = io.StringIO()
ostdout = sys.stdout
sys.stdout = dumpout
print(conn.tonicDNSClient())
@@ -108,7 +111,7 @@ def test_updateTemplate(self):
def test_deleteTemplate(self):
conn.tonicDNSClient = Mock(return_value='true')
- dumpout = StringIO.StringIO()
+ dumpout = io.StringIO()
ostdout = sys.stdout
sys.stdout = dumpout
print(conn.tonicDNSClient())
Please sign in to comment.
Something went wrong with that request. Please try again.