Skip to content

Commit 1414000

Browse files
committed
added testcase for get_map
1 parent 99630c0 commit 1414000

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import unittest
22
from loklak import Loklak
3+
import os
34

45

56
class TestLoklak(unittest.TestCase):
67
def setUp(self):
78
self.loklak = Loklak()
89

10+
def tearDown(self):
11+
try:
12+
os.remove(self.map_file)
13+
except OSError as error:
14+
print(error)
15+
916
def test_hello(self):
1017
result = self.loklak.hello()
1118
self.assertEqual(result, {u'status': u'ok'})
@@ -77,6 +84,15 @@ def test_user(self):
7784
self.assertTrue('name' in result['user'])
7885
self.assertTrue('screen_name' in result['user'])
7986

87+
def test_get_map(self):
88+
self.map_file = os.path.join(os.getcwd(), 'markdown.png')
89+
data = self.loklak.get_map(17.582729, 79.118320)
90+
with open(self.map_file, 'wb') as f:
91+
f.write(data)
92+
with open(self.map_file, 'rb') as f:
93+
file_contents = f.read()
94+
self.assertTrue(os.path.exists(self.map_file))
95+
self.assertEqual(data, file_contents)
8096

8197
if __name__ == '__main__':
8298
unittest.main()

0 commit comments

Comments
 (0)