Example #1
0
    def test_extract_leads_from_chats_excluding_duplicates2(self):
        """
        Different chats between the same operator and the same client should be merged into a single lead where the
        description is the concatenation of the plain texts of the chats.
        """

        operator = Mock()
        operator.email = MagicMock(return_value="operator1@example.com")

        with patch.dict(CHAT1["Chat"], {"Operator": operator}), patch.dict(
            CHAT2["Chat"], {"Operator": operator}
        ), patch.dict(CHAT3["Chat"], {"Operator": operator}):
            chat_list = [CHAT1, CHAT2, CHAT3]
            actual = Livezilla.extract_leads_from_chats(chat_list)
        expected = {
            "name": u"Chat #11123 | Ivone Duarte",
            "description": u"Can you help me?\nA" + "\n" + 20 * "-" + "\n" + u"Can you help me?\nB",
            "contact_name": u"Ivone Duarte",
            "contact_phone": u"967961100",
            "contact_email": u"ivonicha@gmail.com",
            "operator": unicode(operator.email),
            "group": u"groupid1",
            "product_code": None,
        }
        self.assertEqual(2, len(actual))
        self.assertDictEqual(expected, actual[0])
Example #2
0
 def _get_or_add_address(self, email, **kw):  # pylint: disable-msg=unused-argument
     try:
         mm_addr = self.mm_addresses[email]
     except KeyError:
         mm_addr = Mock()
         mm_addr.email = email
         mm_addr.verified_on = None
         self.mm_addresses[email] = mm_addr
     return mm_addr
Example #3
0
    def test_that_helper_adds_email_to_BSD_if_permission_was_given(self, mock_task_func):
        mock_user = Mock()
        mock_user.email = "example@mozilla.org"
        mock_privacy_form = Mock()
        mock_privacy_form.cleaned_data = {"add_me_to_email_list": True}

        views._add_email_to_bsd(mock_user, mock_privacy_form)

        mock_task_func.delay.assert_called_with("example@mozilla.org", "111")
Example #4
0
    def test_that_helper_does_not_add_email_to_BSD_if_permission_refused(self, mock_task_func):
        mock_user = Mock()
        mock_user.email = "example@mozilla.org"
        mock_privacy_form = Mock()
        mock_privacy_form.cleaned_data = {"add_me_to_email_list": False}

        views._add_email_to_bsd(mock_user, mock_privacy_form)

        eq_(mock_task_func.delay.call_args_list, [])
Example #5
0
 def login(self, adapter, provider_name):
     del adapter, provider_name
     response = Mock()
     response.error = self.error
     if self.error:
         response.user = False
     else:
         user = Mock()
         user.name = self.name
         user.email = self.email
         response.user = user
     return response
Example #6
0
    def test_get_committer_data(self):
        committer = Mock()
        committer.email = "foo@bar.com"
        committer.login = "foo"
        data = self.provider.get_committer_data(committer)._identity
        self.assertEqual(data["name"], "foo")
        self.assertEqual(data["email"], "foo@bar.com")

        committer = Mock()
        committer.email = None
        committer.login = "foo"
        committer.get_emails.return_value = [{"primary": True, "email": "primary@bar.com"}]
        data = self.provider.get_committer_data(committer)._identity
        self.assertEqual(data["name"], "foo")
        self.assertEqual(data["email"], "primary@bar.com")

        committer = Mock()
        committer.email = None
        committer.login = "foo"
        committer.get_emails.return_value = []
        with self.assertRaises(errors.NoPermissionError):
            data = self.provider.get_committer_data(committer)
Example #7
0
 def test_existing_address_but_not_verified(self):
     # The secondary address exists but is not verified
     self.mailman_client.get_address.side_effect = self._get_or_add_address
     secondary_address = Mock()
     secondary_address.email = "secondary@example.com"
     secondary_address.verified_on = None
     secondary_address.__unicode__ = lambda self: self.email
     self.mm_user.addresses.append(secondary_address)
     details = {"secondary_email": "secondary@example.com"}
     mailman.add_user_to_mailman(self.user, details)
     # The secondary address must only have been verified.
     self.assertFalse(self.mm_user.add_address.called)
     secondary_address.verify.assert_called_with()
Example #8
0
    def test_success(self):
        users_mock = Mock()
        google_user = Mock()
        user_email = "foo@bar.com"
        google_user.email = Mock(return_value=user_email)
        users_mock.get_current_user = Mock(return_value=google_user)
        users_mock.is_current_user_admin = Mock(return_value=True)
        sites.users = users_mock
        setup = facade.initial_setup()
        setup.execute()
        site = setup.result

        find = facade.find_current_site()
        find.execute()
        self.assertEqual(site.key, find.result.key)
Example #9
0
    def test_that_create_event_and_venue_does_that_given_valid_data(self):
        event_kind = models.EventKind(name="Test", slug="test", description="Test")
        event_kind.save()
        self.data["event-kind"] = str(event_kind.id)
        ef = forms.EventForm(self.data)
        vf = forms.VenueForm(self.data)
        mock_user = Mock()
        mock_user.email = "example@mozilla.org"

        event, venue = views._create_event_and_venue(mock_user, ef, vf)

        ok_(event.id is not None)
        ok_(venue.id is not None)
        eq_(venue.location.y, 51.0)
        eq_(venue, event.venue)
Example #10
0
def test_get_email():
    """Tests whether it gives back the user.email property"""
    with patch("h.notification.reply_template.Annotation") as mock_annotation:
        mock_annotation.fetch = MagicMock(side_effect=fake_fetch)
        with patch("h.notification.reply_template.get_user_by_name") as mock_user_db:
            user = Mock()
            user.email = "testmail@test.com"
            mock_user_db.return_value = user
            request = _create_request()

            annotation = store_fake_data[1]
            data = {"parent": rt.parent_values(annotation), "subscription": {"id": 1}}

            email = rt.get_recipients(request, data)
            assert email[0] == user.email
Example #11
0
 def test_success(self):
     users_mock = Mock()
     google_user = Mock()
     user_email = "foo@bar.com"
     google_user.email = Mock(return_value=user_email)
     users_mock.get_current_user = Mock(return_value=google_user)
     users_mock.is_current_user_admin = Mock(return_value=True)
     sites.users = users_mock
     setup = facade.initial_setup()
     setup.execute()
     site = setup.result
     self.assertEqual(settings.APP_HOST, site.domain)
     find_user = FindOrCreateUser(user_email)
     find_user.execute()
     user = find_user.result
     search = SitesSearch(to_node_key(user))
     search.execute()
     user_sites = search.result
     self.assertListEqual([site.key], [s.key for s in user_sites])
Example #12
0
def test_send_if_everything_is_okay():
    """Test whether we generate notifications if every condition is okay"""
    request = _create_request()

    annotation = Annotation.fetch(1)
    with patch("h.notification.reply_template.Subscriptions") as mock_subs:
        mock_subs.get_active_subscriptions_for_a_type.return_value = [
            MockSubscription(id=1, uri="acct:elephant@nomouse.pls")
        ]
        with patch("h.notification.reply_template.check_conditions") as mock_conditions:
            mock_conditions.return_value = True
            with patch("h.notification.reply_template.render") as mock_render:
                mock_render.return_value = ""
                with patch("h.notification.reply_template.get_user_by_name") as mock_user_db:
                    user = Mock()
                    user.email = "testmail@test.com"
                    mock_user_db.return_value = user
                    msgs = rt.generate_notifications(request, annotation, "create")
                    msgs.next()
Example #13
0
    def test_extract_leads_from_chats(self):
        operator = Mock()
        operator.email = MagicMock(return_value="operator1@example.com")
        product_reference = "PF12345"

        with patch.dict(CHAT1["Chat"], {"Operator": operator, "Customs": {"Imovel": product_reference}}):
            chat_list = [CHAT1]
            actual = Livezilla.extract_leads_from_chats(chat_list)
        expected = {
            "name": u"Chat #11123 | Ivone Duarte",
            "description": u"Can you help me?\nA",
            "contact_name": u"Ivone Duarte",
            "contact_phone": u"967961100",
            "contact_email": u"ivonicha@gmail.com",
            "operator": unicode(operator.email),
            "group": u"groupid1",
            "product_code": product_reference,
        }
        self.assertEqual(1, len(actual))
        self.assertDictEqual(expected, actual[0])
 def get_user_info(self, user):
     info = Mock()
     info.email = "x@example.com"
     return info
Example #15
0
    def test_create_extended_resource_container(self):

        mock_clients = self._create_service_mock("resource_registry")

        self.clients = mock_clients

        extended_resource_handler = ExtendedResourceContainer(self, mock_clients.resource_registry)

        instrument_device = Mock()
        instrument_device._id = "123"
        instrument_device.name = "MyInstrument"
        instrument_device.type_ = RT.InstrumentDevice

        actor_identity = Mock()
        actor_identity._id = "111"
        actor_identity.name = "Foo"
        actor_identity.type_ = RT.ActorIdentity

        user_info = Mock()
        user_info.name = "John Doe"
        user_info.email = "John.Doe@devnull.com"
        user_info.phone = "555-555-5555"
        user_info.variables = [{"name": "subscribeToMailingList", "value": "False"}]

        # ActorIdentity to UserInfo association
        actor_identity_to_info_association = Mock()
        actor_identity_to_info_association._id = "555"
        actor_identity_to_info_association.s = "111"
        actor_identity_to_info_association.st = RT.ActorIdentity
        actor_identity_to_info_association.p = PRED.hasInfo
        actor_identity_to_info_association.o = "444"
        actor_identity_to_info_association.ot = RT.UserInfo

        # ActorIdentity to UserInfo association
        Instrument_device_to_actor_identity_association = Mock()
        Instrument_device_to_actor_identity_association._id = "666"
        Instrument_device_to_actor_identity_association.s = "123"
        Instrument_device_to_actor_identity_association.st = RT.InstumentDevice
        Instrument_device_to_actor_identity_association.p = PRED.hasOwner
        Instrument_device_to_actor_identity_association.o = "111"
        Instrument_device_to_actor_identity_association.ot = RT.ActorIdentity

        with self.assertRaises(BadRequest) as cm:
            extended_user = extended_resource_handler.create_extended_resource_container(RT.ActorIdentity, "111")
        self.assertIn("Requested resource ActorIdentity is not extended from ResourceContainer", cm.exception.message)

        obj = IonObject(OT.TestExtendedResource)
        list_objs = ["123", "456", "789"]
        extended_resource_handler.set_field_associations(obj, "policies", list_objs)
        extended_resource_handler.set_field_associations(obj, "policy_count", list_objs)
        extended_resource_handler.set_field_associations(obj, "resource_object", list_objs)

        self.assertEquals(obj.policies, list_objs)
        self.assertEquals(obj.policy_count, 3)
        self.assertEquals(obj.resource_object, "123")

        mock_clients.resource_registry.read.return_value = instrument_device
        mock_clients.resource_registry.find_objects.return_value = (
            [actor_identity],
            [Instrument_device_to_actor_identity_association],
        )

        extended_res = extended_resource_handler.create_extended_resource_container(OT.TestExtendedResource, "123")
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 1)

        # Test field exclusion
        extended_res = extended_resource_handler.create_extended_resource_container(
            OT.TestExtendedResource, "123", ext_exclude=["owners"]
        )
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 0)
Example #16
0
    def test_create_extended_resource_container(self):

        mock_clients = self._create_service_mock("resource_registry")

        self.clients = mock_clients
        self.container = Mock()

        extended_resource_handler = ExtendedResourceContainer(self, mock_clients.resource_registry)

        instrument_device = Mock()
        instrument_device._id = "123"
        instrument_device.name = "MyInstrument"
        instrument_device.type_ = RT.InstrumentDevice

        instrument_device2 = Mock()
        instrument_device2._id = "456"
        instrument_device2.name = "MyInstrument2"
        instrument_device2.type_ = RT.InstrumentDevice

        actor_identity = Mock()
        actor_identity._id = "111"
        actor_identity.name = "Foo"
        actor_identity.type_ = RT.ActorIdentity

        user_info = Mock()
        user_info._id = "444"
        user_info.name = "John Doe"
        user_info.email = "John.Doe@devnull.com"
        user_info.phone = "555-555-5555"
        user_info.variables = [{"name": "subscribeToMailingList", "value": "False"}]

        user_info2 = Mock()
        user_info2._id = "445"
        user_info2.name = "aka Evil Twin"
        user_info2.email = "Evil.Twin@devnull.com"
        user_info2.phone = "555-555-5555"
        user_info2.variables = [{"name": "subscribeToMailingList", "value": "False"}]

        # ActorIdentity to UserInfo association
        actor_identity_to_info_association = Mock()
        actor_identity_to_info_association._id = "555"
        actor_identity_to_info_association.s = "111"
        actor_identity_to_info_association.st = RT.ActorIdentity
        actor_identity_to_info_association.p = PRED.hasInfo
        actor_identity_to_info_association.o = "444"
        actor_identity_to_info_association.ot = RT.UserInfo

        # ActorIdentity to UserInfo association
        actor_identity_to_info_association2 = Mock()
        actor_identity_to_info_association2._id = "556"
        actor_identity_to_info_association2.s = "111"
        actor_identity_to_info_association2.st = RT.ActorIdentity
        actor_identity_to_info_association2.p = PRED.hasInfo
        actor_identity_to_info_association2.o = "445"
        actor_identity_to_info_association2.ot = RT.UserInfo

        # ActorIdentity to Instrument Device association
        Instrument_device_to_actor_identity_association = Mock()
        Instrument_device_to_actor_identity_association._id = "666"
        Instrument_device_to_actor_identity_association.s = "123"
        Instrument_device_to_actor_identity_association.st = RT.InstumentDevice
        Instrument_device_to_actor_identity_association.p = PRED.hasOwner
        Instrument_device_to_actor_identity_association.o = "111"
        Instrument_device_to_actor_identity_association.ot = RT.ActorIdentity

        # ActorIdentity to Instrument Device association
        Instrument_device_to_actor_identity_association2 = Mock()
        Instrument_device_to_actor_identity_association2._id = "667"
        Instrument_device_to_actor_identity_association2.s = "456"
        Instrument_device_to_actor_identity_association2.st = RT.InstumentDevice
        Instrument_device_to_actor_identity_association2.p = PRED.hasOwner
        Instrument_device_to_actor_identity_association2.o = "111"
        Instrument_device_to_actor_identity_association2.ot = RT.ActorIdentity

        with self.assertRaises(BadRequest) as cm:
            extended_user = extended_resource_handler.create_extended_resource_container(RT.ActorIdentity, "111")
        self.assertIn(
            "The requested resource ActorIdentity is not extended from ResourceContainer", cm.exception.message
        )

        mock_clients.resource_registry.read.return_value = instrument_device
        mock_clients.resource_registry.find_objects.return_value = (
            [actor_identity],
            [Instrument_device_to_actor_identity_association],
        )
        mock_clients.resource_registry.find_subjects.return_value = (None, None)
        mock_clients.resource_registry.find_associations.return_value = [
            actor_identity_to_info_association,
            Instrument_device_to_actor_identity_association,
        ]
        mock_clients.resource_registry.read_mult.return_value = [user_info]

        extended_res = extended_resource_handler.create_extended_resource_container(OT.TestExtendedResource, "123")
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 1)
        self.assertEquals(extended_res.resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)
        self.assertEquals(extended_res.resource_object.name, "TestSystem_Resource")

        # Test adding extra paramaters to methods
        extended_res = extended_resource_handler.create_extended_resource_container(
            OT.TestExtendedResource, "123", resource_name="AltSystem_Resource"
        )
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 1)
        self.assertEquals(extended_res.resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)
        self.assertEquals(extended_res.resource_object.name, "AltSystem_Resource")

        # Test field exclusion
        extended_res = extended_resource_handler.create_extended_resource_container(
            OT.TestExtendedResource, "123", ext_exclude=["owners"]
        )
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 0)
        self.assertEquals(extended_res.resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)

        # Test the list of ids interface
        extended_res_list = extended_resource_handler.create_extended_resource_container_list(
            OT.TestExtendedResource, ["123", "456"]
        )
        self.assertEqual(len(extended_res_list), 2)
        self.assertEquals(extended_res_list[0].resource, instrument_device)
        self.assertEquals(len(extended_res_list[0].owners), 1)
        self.assertEquals(extended_res_list[0].resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)
Example #17
0
    def test_create_extended_resource_container(self):

        mock_clients = self._create_service_mock("resource_registry")

        self.clients = mock_clients
        self.container = Mock()

        extended_resource_handler = ExtendedResourceContainer(self, mock_clients.resource_registry)

        instrument_device = Mock()
        instrument_device._id = "123"
        instrument_device.name = "MyInstrument"
        instrument_device.type_ = RT.InstrumentDevice
        instrument_device.lcstate = LCS.DRAFT
        instrument_device.availability = AS.PRIVATE

        instrument_device2 = Mock()
        instrument_device2._id = "456"
        instrument_device2.name = "MyInstrument2"
        instrument_device2.type_ = RT.InstrumentDevice

        actor_identity = Mock()
        actor_identity._id = "111"
        actor_identity.name = "Foo"
        actor_identity.type_ = RT.ActorIdentity

        actor_identity = Mock()
        actor_identity._id = "1112"
        actor_identity.name = "Foo2"
        actor_identity.type_ = RT.ActorIdentity

        user_info = Mock()
        user_info._id = "444"
        user_info.name = "John Doe"
        user_info.email = "John.Doe@devnull.com"
        user_info.phone = "555-555-5555"
        user_info.variables = [{"name": "subscribeToMailingList", "value": "False"}]

        user_info2 = Mock()
        user_info2._id = "445"
        user_info2.name = "aka Evil Twin"
        user_info2.email = "Evil.Twin@devnull.com"
        user_info2.phone = "555-555-5555"
        user_info2.variables = [{"name": "subscribeToMailingList", "value": "False"}]

        # ActorIdentity to UserInfo association
        actor_identity_to_info_association = Mock()
        actor_identity_to_info_association._id = "555"
        actor_identity_to_info_association.s = "111"
        actor_identity_to_info_association.st = RT.ActorIdentity
        actor_identity_to_info_association.p = PRED.hasInfo
        actor_identity_to_info_association.o = "444"
        actor_identity_to_info_association.ot = RT.UserInfo

        # ActorIdentity to UserInfo association
        actor_identity_to_info_association2 = Mock()
        actor_identity_to_info_association2._id = "556"
        actor_identity_to_info_association2.s = "1112"
        actor_identity_to_info_association2.st = RT.ActorIdentity
        actor_identity_to_info_association2.p = PRED.hasInfo
        actor_identity_to_info_association2.o = "445"
        actor_identity_to_info_association2.ot = RT.UserInfo

        # ActorIdentity to Instrument Device association
        Instrument_device_to_actor_identity_association = Mock()
        Instrument_device_to_actor_identity_association._id = "666"
        Instrument_device_to_actor_identity_association.s = "123"
        Instrument_device_to_actor_identity_association.st = RT.InstrumentDevice
        Instrument_device_to_actor_identity_association.p = PRED.hasOwner
        Instrument_device_to_actor_identity_association.o = "111"
        Instrument_device_to_actor_identity_association.ot = RT.ActorIdentity

        # ActorIdentity to Instrument Device association
        Instrument_device_to_actor_identity_association2 = Mock()
        Instrument_device_to_actor_identity_association2._id = "667"
        Instrument_device_to_actor_identity_association2.s = "456"
        Instrument_device_to_actor_identity_association2.st = RT.InstrumentDevice
        Instrument_device_to_actor_identity_association2.p = PRED.hasOwner
        Instrument_device_to_actor_identity_association2.o = "111"
        Instrument_device_to_actor_identity_association2.ot = RT.ActorIdentity

        with self.assertRaises(BadRequest) as cm:
            extended_user = extended_resource_handler.create_extended_resource_container(RT.ActorIdentity, "111")
        self.assertIn(
            "The requested resource ActorIdentity is not extended from ResourceContainer", cm.exception.message
        )

        mock_clients.resource_registry.read.return_value = instrument_device
        mock_clients.resource_registry.find_objects.return_value = (
            [actor_identity],
            [Instrument_device_to_actor_identity_association],
        )
        mock_clients.resource_registry.find_subjects.return_value = (None, None)
        mock_clients.resource_registry.find_associations.return_value = [
            actor_identity_to_info_association,
            Instrument_device_to_actor_identity_association,
        ]
        mock_clients.resource_registry.read_mult.return_value = [user_info]

        extended_res = extended_resource_handler.create_extended_resource_container(OT.TestExtendedResource, "123")
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 2)
        self.assertEquals(extended_res.resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)
        self.assertEquals(extended_res.resource_object.name, "TestSystem_Resource")
        self.assertEquals(extended_res.owner_count, 2)
        self.assertEquals(extended_res.single_owner.name, user_info.name)
        self.assertEquals(len(extended_res.lcstate_transitions), 6)
        self.assertEquals(
            set(extended_res.lcstate_transitions.keys()),
            set(["develop", "deploy", "retire", "plan", "integrate", "delete"]),
        )
        self.assertEquals(len(extended_res.availability_transitions), 2)
        self.assertEquals(set(extended_res.availability_transitions.keys()), set(["enable", "announce"]))

        extended_res = extended_resource_handler.create_extended_resource_container(
            OT.TestExtendedResourceDevice, "123"
        )
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 2)

        with self.assertRaises(Inconsistent) as cm:
            extended_res = extended_resource_handler.create_extended_resource_container(
                OT.TestExtendedResourceBad, "123"
            )

        # Test adding extra paramaters to methods
        extended_res = extended_resource_handler.create_extended_resource_container(
            OT.TestExtendedResource, "123", resource_name="AltSystem_Resource"
        )
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 2)
        self.assertEquals(extended_res.resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)
        self.assertEquals(extended_res.resource_object.name, "AltSystem_Resource")

        # Test field exclusion
        extended_res = extended_resource_handler.create_extended_resource_container(
            OT.TestExtendedResource, "123", ext_exclude=["owners"]
        )
        self.assertEquals(extended_res.resource, instrument_device)
        self.assertEquals(len(extended_res.owners), 0)
        self.assertEquals(extended_res.resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)

        # Test the list of ids interface
        extended_res_list = extended_resource_handler.create_extended_resource_container_list(
            OT.TestExtendedResource, ["123", "456"]
        )
        self.assertEqual(len(extended_res_list), 2)
        self.assertEquals(extended_res_list[0].resource, instrument_device)
        self.assertEquals(len(extended_res_list[0].owners), 2)
        self.assertEquals(extended_res_list[0].resource_object.type_, RT.SystemResource)
        self.assertEquals(extended_res.remote_resource_object.type_, RT.InstrumentDevice)

        # Test create_prepare_update_resource
        prepare_create = extended_resource_handler.create_prepare_resource_support(
            prepare_resource_type=OT.TestPrepareUpdateResource
        )
        self.assertEqual(prepare_create.type_, OT.TestPrepareUpdateResource)
        self.assertEqual(prepare_create._id, "")

        prepare_update = extended_resource_handler.create_prepare_resource_support(
            resource_id="123", prepare_resource_type=OT.TestPrepareUpdateResource
        )
        self.assertEqual(prepare_update.type_, OT.TestPrepareUpdateResource)
        self.assertEqual(prepare_update._id, "123")
def _get_user_mock(email):
    user = Mock(spec=User)
    user.email = email
    return user
Example #19
0
 def get_maintainer(self):
     maint = Mock()
     maint.email = "foo@bar.com"
     maint.name = "John Foo"
     return maint
Example #20
0
 def mock_google_account_user(self):
     google_account_user = Mock()
     google_account_user.user_id = lambda: "123"
     google_account_user.email = lambda: "foo@gmail.com"
     google_account_user.nickname = lambda: "foo"
     return google_account_user