Ejemplo n.º 1
0
 def test_single_interactions_different_conversation(self):
     """test that single interactions created with separate calls have unique
     conversations for same rater"""
     results1 = create_interactions(
         self.rater_user_id, (f"<@U{randint(100000, 999999)}>", choice(["+", "-"]))
     )
     results2 = create_interactions(
         self.rater_user_id, (f"<@U{randint(100000, 999999)}>", choice(["+", "-"]))
     )
     self.assertNotEqual(results1[0].conversation, results2[0].conversation)
Ejemplo n.º 2
0
 def setUp(self):
     self.rater_id = f"@R{randint(100000, 999999)}"
     for num in range(20):
         create_interactions(
             self.rater_id,
             (f"@U{randint(100000, 999999)}",
              choice([Interaction.POSITIVE, Interaction.NEGATIVE]))
         )
     for num in range(20):
         create_interactions(
             f"@U{randint(100000, 999999)}",
             (self.rater_id,
              choice([Interaction.POSITIVE, Interaction.NEGATIVE]))
         )
Ejemplo n.º 3
0
 def test_returns_list_of_interactions_single(self):
     """test that the util returns a list of Interaction objects of proper size"""
     results = create_interactions(
         self.rater_user_id, (f"@U{randint(100000, 999999)}", choice(["+", "-"]))
     )
     self.assertEqual(len(results), 1)
     self.assertIsInstance(results[0], Interaction)
Ejemplo n.º 4
0
 def test_multiple_interactions_share_conversation(self):
     """test that multiple interactions created with one call share a conversation"""
     total_num_expected = 5
     interaction_tuples = [(f"<@U{randint(100000, 999999)}>", choice(["+", "-"]))
                           for num in range(total_num_expected)]
     results = create_interactions(self.rater_user_id, *interaction_tuples)
     conversations = set([result.conversation for result in results])
     self.assertEqual(len(conversations), 1)
Ejemplo n.º 5
0
 def test_returns_list_of_interactions_multiple(self):
     """test that the util returns a list of Interaction objects of proper size"""
     total_num_expected = 5
     interaction_tuples = [(f"@U{randint(100000, 999999)}", choice(["+", "-"]))
                           for num in range(total_num_expected)]
     results = create_interactions(self.rater_user_id, *interaction_tuples)
     self.assertEqual(len(results), total_num_expected)
     for result in results:
         self.assertIsInstance(result, Interaction)