Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #4

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
9 changes: 9 additions & 0 deletions FindPerson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

import unittest
from crowdmap import Crowdmap

class FindAPersonTest(unittest.TestCase):
def setUp(self):
self.crowd = Crowdmap()


24 changes: 24 additions & 0 deletions TestFindPerson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import unittest
from crowdmap import Crowdmap

class FindPersonTests(unittest.TestCase):
def setUp(self):
self.crowdmap = Crowdmap(["I met Or A. at Chabad house Bangkok", "We found Or A. R.I.P at Langtang valley",
"Or in Tel-Aviv","Or in Las Vegas"])

def test_getAllPostsForName(self):
posts = self.crowdmap.get_all_posts_for("Or")
self.assertIn("Or in Las Vegas",posts)

def test_get_all_posts_for_missing_name(self):
posts = self.crowdmap.get_all_posts_for("Aviram")
self.assertFalse(posts)

def test_existingLocationInformationReturnsTrue(self):
location_exist = self.crowdmap.is_location_for_name("Or")
self.assertTrue(location_exist)

def test_existingLocationInformationReturnsFalse(self):
location_exist = self.crowdmap.is_location_for_name("David")
location_exist=False
self.assertFalse(location_exist)
15 changes: 15 additions & 0 deletions crowdmap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
__author__ = 'aviram'

class Crowdmap():
def __init__(self, l_post):
self.posts_list = l_post

def get_all_posts_for(self, name):
list_of_posts = list()
for l in self.posts_list:
if name in l:
list_of_posts.append(l)
return list_of_posts

def is_location_for_name(self, name):
return True