Exemple #1
0
    def test_serialize_teams_user(self):
        teams_user_identifier_model = serialize_identifier(
            MicrosoftTeamsUserIdentifier(
                user_id="teamsid",
                cloud=CommunicationCloudEnvironment.PUBLIC,
                raw_id="someid"))

        assert teams_user_identifier_model['microsoft_teams_user'][
            'user_id'] is "teamsid"
        assert teams_user_identifier_model['microsoft_teams_user'][
            'cloud'] is CommunicationCloudEnvironment.PUBLIC
        assert teams_user_identifier_model['raw_id'] is "someid"
Exemple #2
0
    def test_serialize_phone_number(self):
        phone_number_identifier_model = serialize_identifier(
            PhoneNumberIdentifier("phonenumber"))

        assert phone_number_identifier_model['phone_number'][
            'value'] is "phonenumber"
Exemple #3
0
    def test_serialize_communication_user(self):
        communication_identifier_model = serialize_identifier(
            CommunicationUserIdentifier("an id"))

        assert communication_identifier_model['communication_user'][
            'id'] is "an id"
Exemple #4
0
    def test_serialize_unknown_identifier(self):
        unknown_identifier_model = serialize_identifier(
            UnknownIdentifier("an id"))

        assert unknown_identifier_model['raw_id'] is "an id"
Exemple #5
0
 def test_serialize_foreign_throws(self):
     foreign_obj = "Foreign object"
     self.assertRaises(TypeError, lambda: serialize_identifier(foreign_obj))