def test_multiple_registrations_on_the_same_phone(self):
        xform_factory.create_simple_xform()

        now = datetime.now()
        ordered_times = [datetime(now.year, now.month, now.day, 1),
                         datetime(now.year, now.month, now.day, 2),
                         datetime(now.year, now.month, now.day, 3)]

        xform_factory.create_registration_instance({
            u'start': ordered_times[0], u'name': u'Betty Bimbob',
            u'sex': u'female', u'birth_date': u'1970-07-07',
            u'device_id': u'12345'})

        xform_factory.create_registration_instance({
            u'start': ordered_times[1], u'name': u'Alex Adams',
            u'birth_date': u'1986-08-15', u'device_id': u'12345'})

        self.assertTrue(Surveyor.objects.count(), 2)

        submission = xform_factory.create_simple_instance(
            {u'start': ordered_times[2]})

        self.assertTrue(submission.parsed_instance.surveyor is not None)
        self.assertEqual(submission.parsed_instance.surveyor.name,
                         u'Alex Adams')
Two users registered to phone '12345'.
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/viewer/tests/surveyor_registration.py/TestSurveyorRegistration.test_multiple_registrations_on_the_same_phone