Skip to content

Commit a8cca5b

Browse files
committed
Merge pull request #24 from yasoob/patch-4
added testcase for get_map
2 parents bda097f + 1414000 commit a8cca5b

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,5 +1,6 @@
11
import unittest
22
from loklak import Loklak
3+
import os
34

45

56
class TestLoklak(unittest.TestCase):
@@ -8,6 +9,12 @@ def setUp(self):
89
"""test proper setup"""
910
self.loklak = Loklak()
1011

12+
def tearDown(self):
13+
try:
14+
os.remove(self.map_file)
15+
except OSError as error:
16+
print(error)
17+
1118
def test_hello(self):
1219
"""test hello instance"""
1320
result = self.loklak.hello()
@@ -85,6 +92,15 @@ def test_user(self):
8592
self.assertTrue('name' in result['user'])
8693
self.assertTrue('screen_name' in result['user'])
8794

95+
def test_get_map(self):
96+
self.map_file = os.path.join(os.getcwd(), 'markdown.png')
97+
data = self.loklak.get_map(17.582729, 79.118320)
98+
with open(self.map_file, 'wb') as f:
99+
f.write(data)
100+
with open(self.map_file, 'rb') as f:
101+
file_contents = f.read()
102+
self.assertTrue(os.path.exists(self.map_file))
103+
self.assertEqual(data, file_contents)
88104

89105
if __name__ == '__main__':
90106
unittest.main()

0 commit comments

Comments
 (0)