Ejemplo n.º 1
0
 def test_dehydrated_activity(self):
     activity_object = Pin(id=1)
     activity = Activity(1, LoveVerb, activity_object)
     dehydrated = activity.get_dehydrated()
     self.assertTrue(isinstance(dehydrated, DehydratedActivity))
     self.assertEquals(
         dehydrated.serialization_id, activity.serialization_id)
Ejemplo n.º 2
0
 def test_serialization_length(self):
     activity_object = Pin(id=1)
     activity = Activity(1, LoveVerb, activity_object)
     assert len(str(activity.serialization_id)) == 26
Ejemplo n.º 3
0
 def add_entry(self, user_id, activity_id):
     verb = Love()
     activity = Activity(user_id, verb, activity_id)
     self.add_user_activity(user_id, activity)
Ejemplo n.º 4
0
 def generate_activities(self):
     activities = []
     for x in range(1, 20):
         activity = Activity(x, LoveVerb, Pin(id=x))
         activities.append(activity)
     return activities
Ejemplo n.º 5
0
 def test_contains_extraneous_object(self):
     activity = AggregatedActivity(1, [Activity(1, LoveVerb, Pin(id=1))])
     with self.assertRaises(ValueError):
         activity.contains(Pin(id=1))
Ejemplo n.º 6
0
 def test_compare_apple_and_oranges(self):
     activity = AggregatedActivity(1, [Activity(1, LoveVerb, Pin(id=1))])
     with self.assertRaises(ValueError):
         activity == Pin(id=1)
Ejemplo n.º 7
0
 def test_duplicated_activities(self):
     activity = Activity(1, LoveVerb, Pin(id=1))
     aggregated = AggregatedActivity(1, [activity])
     with self.assertRaises(DuplicateActivityException):
         aggregated.append(activity)
Ejemplo n.º 8
0
 def test_contains(self):
     activity = Activity(1, LoveVerb, Pin(id=1))
     aggregated = AggregatedActivity(1, [activity])
     self.assertTrue(aggregated.contains(activity))
Ejemplo n.º 9
0
 def test_compare_apple_and_oranges(self):
     activity_object = Pin(id=1)
     activity = Activity(1, LoveVerb, activity_object)
     with self.assertRaises(ValueError):
         activity == activity_object
Ejemplo n.º 10
0
 def test_serialization_overflow_check_role_id(self):
     activity_object = Pin(id=1)
     Verb = type('Overflow', (LoveVerb,), {'id': 9999})
     activity = Activity(1, Verb, activity_object)
     with self.assertRaises(TypeError):
         activity.serialization_id
Ejemplo n.º 11
0
 def test_serialization_overflow_check_object_id(self):
     activity_object = Pin(id=10 ** 10)
     activity = Activity(1, LoveVerb, activity_object)
     with self.assertRaises(TypeError):
         activity.serialization_id
Ejemplo n.º 12
0
 def test_serialization_type(self):
     activity_object = Pin(id=1)
     activity = Activity(1, LoveVerb, activity_object)
     assert isinstance(activity.serialization_id, (int, long, float))