示例#1
0
 def setUp(self):
     self.user = UserFactory(is_admin=True)
     self.solo_user = UserFactory(email='*****@*****.**',
                                  name="userSolo",
                                  user_connected=0)  # user_connected = SOLO
     self.application = ApplicationFactory()
     self.incidentTemplate = IncidentTemplateFactory(template_id=1)
     self.domain = DomainFactory(domain_id=1)
     self.domain = DomainFactory(domain_id=2,
                                 domain='api-dev-au.medic52.com',
                                 is_active=True)
     self.domain = DomainFactory(domain='testserver', is_active=True)
     self.license_expiry_date = timezone.now() + datetime.timedelta(days=2)
     self.resort = ResortFactory(
         domain_id=self.domain,
         resort_name='Vanilla Ski',
         license_expiry_date=self.license_expiry_date.isoformat(),
         licenses="2")
     self.resort1 = ResortFactory(domain_id=self.domain,
                                  resort_name='Vanilla Ski 1356',
                                  network_key="tYm6zUiK")
     self.userRoles = UserRolesFactory(role_id=1)
     self.userRoles = UserRolesFactory(role_id=2, key='dispatcher', order=2)
     self.userRoles = UserRolesFactory(role_id=3, key='manager', order=3)
     self.user_resort_map = UserResortMapFactory(role_id=3,
                                                 user=self.user,
                                                 resort=self.resort)
     self.user_resort_map = UserResortMapFactory(role_id=3,
                                                 user=self.solo_user,
                                                 resort=self.resort1)
     self.c = APIClient()
     self.token = TokenFactory(user=self.user)
示例#2
0
class RoutingUserFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = RoutingUser
        django_get_or_create = ('email', 'domain')

    email = UserFactory().email
    domain = DomainFactory()
 def setUp(self):
     self.user = UserFactory()
     self.application = ApplicationFactory()
     # Clear ALL existing Domains
     Domains.objects.all().delete()
     self.domain = DomainFactory(__sequence=1,
                                 domain='api-dev-us.medic52.com')
     self.domain = DomainFactory(domain_id=2,
                                 domain='api-dev-au.medic52.com',
                                 is_active=True)
     self.domain = DomainFactory(domain='testserver', is_active=True)
     self.domain = DomainFactory(domain='localhost', is_active=True)
     self.incidentTemplate = IncidentTemplateFactory(template_id=1)
     self.resort = ResortFactory(domain_id=self.domain,
                                 resort_name='Vanilla Ski',
                                 license_expiry_date='2018-04-01T00:00:00',
                                 licenses=5)
     self.userRoles = UserRolesFactory(role_id=1)
     self.userRolesDispatcher = UserRolesFactory(role_id=2,
                                                 key='dispatcher',
                                                 order=2)
     self.userRolesManager = UserRolesFactory(role_id=3,
                                              key='manager',
                                              order=3)
     self.user_resort_map = UserResortMapFactory(
         role_id=self.userRolesDispatcher.role_id,
         user=self.user,
         resort=self.resort)
     self.c = APIClient()
     self.token = TokenFactory(user=self.user)
示例#4
0
class HeartbeatFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = Heartbeat
        django_get_or_create = {'user', 'device'}

    user = UserFactory()
    device = DevicesFactory()
    heartbeat_datetime = timezone.now()
 def setUp(self):
     self.userPatroller = UserFactory(email='*****@*****.**',
                                      name='Mr Patroller',
                                      user_connected=1,
                                      is_active=True)
     self.userDispatcher = UserFactory(email='*****@*****.**',
                                       name='Mr Dispatcher',
                                       user_connected=1,
                                       is_active=True)
     self.userManager = UserFactory(email='*****@*****.**',
                                    name='Mr Manager',
                                    user_connected=1,
                                    is_active=True)
     self.application = ApplicationFactory()
     self.incidentTemplate = IncidentTemplateFactory(template_id=1)
     self.domain = DomainFactory(domain_id=1)
     self.domain = DomainFactory(domain='api-dev-au.medic52.com',
                                 is_active=True)
     self.domain = DomainFactory(domain='testserver', is_active=True)
     # self.domain = Domains.objects.all()
     # print Domains.objects.get(pk=1), "debug"
     self.resort = ResortFactory(domain_id=self.domain)
     self.userRolePatroller = UserRolesFactory(role_id=1,
                                               key='patroller',
                                               order=1)
     self.userRoleDispatcher = UserRolesFactory(role_id=2,
                                                key='dispatcher',
                                                order=2)
     self.userRoleManager = UserRolesFactory(role_id=3,
                                             key='manager',
                                             order=3)
     self.userResortMapPatroller = UserResortMapFactory(
         role_id=self.userRolePatroller.role_id,
         user=self.userPatroller,
         resort=self.resort)
     self.userResortMapDispatcher = UserResortMapFactory(
         role_id=self.userRoleDispatcher.role_id,
         user=self.userDispatcher,
         resort=self.resort)
     self.userResortMapManager = UserResortMapFactory(
         role_id=self.userRoleManager.role_id,
         user=self.userManager,
         resort=self.resort)
     self.c = APIClient()
     self.token = TokenFactory(user=self.userManager)
示例#6
0
class IncidentFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = Incident

    resort = ResortFactory()
    assigned_to = UserFactory()
    dt_created = datetime.datetime.now()
    dt_modified = datetime.datetime.now()
    incident_status = IncidentStatusFactory()
class ApplicationFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = Application
        django_get_or_create = ('name', )

    name = "medic52"
    user = UserFactory()
    client_type = 'confidential'
    authorization_grant_type = 'client-credentials'
示例#8
0
class DevicesFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = Devices
        django_get_or_create = {
            'device_id',
        }

    device_type = 'android'
    device_os = 'android'
    device_push_token = 'abcdefghijklmnopqrst123456789'
    device_state = 0
    device_user = UserFactory()
 def setUp(self):
     self.user = UserFactory()
     self.inactive_user = UserFactory(email='*****@*****.**',
                                      name='Duncan',
                                      is_active=False)
     self.userPatroller = UserFactory(email='*****@*****.**',
                                      name='Mr Patroller',
                                      user_connected=1,
                                      is_active=True)
     self.userPatroller2 = UserFactory(email='*****@*****.**',
                                       name='Mr Patroller2',
                                       user_connected=1,
                                       is_active=True)
     self.userDispatcher = UserFactory(email='*****@*****.**',
                                       name='Mr Dispatcher',
                                       user_connected=1,
                                       is_active=True)
     self.userDispatcher2 = UserFactory(email='*****@*****.**',
                                        name='Mr Dispatcher2',
                                        user_connected=1,
                                        is_active=True)
     self.language = LanguageFactory()
     self.domain = DomainFactory(domain_id=1)
     self.incidentTemplate = IncidentTemplateFactory(template_id=1)
     self.resort = ResortFactory(domain_id=self.domain)
     self.userRolePatroller = UserRolesFactory(role_id=1,
                                               key='patroller',
                                               order=1)
     self.userRoleDispatcher = UserRolesFactory(role_id=2,
                                                key='dispatcher',
                                                order=2)
     self.userRoleManager = UserRolesFactory(role_id=3,
                                             key='manager',
                                             order=3)
     self.userResortMapPatroller = UserResortMapFactory(
         role_id=self.userRolePatroller.role_id,
         user=self.userPatroller,
         resort=self.resort)
     self.userResortMapPatroller2 = UserResortMapFactory(
         role_id=self.userRolePatroller.role_id,
         user=self.userPatroller2,
         resort=self.resort)
     self.userResortMapDispatcher = UserResortMapFactory(
         role_id=self.userRoleDispatcher.role_id,
         user=self.userDispatcher,
         resort=self.resort)
     self.userResortMapDispatcher2 = UserResortMapFactory(
         role_id=self.userRoleDispatcher.role_id,
         user=self.userDispatcher2,
         resort=self.resort)
     self.userResortMapManager = UserResortMapFactory(
         role_id=self.userRoleManager.role_id,
         user=self.user,
         resort=self.resort)
     self.incidentStatus = IncidentStatusFactory(incident_status_id=1)
     self.application = ApplicationFactory()
     self.c = APIClient()
     self.token = TokenFactory(user=self.user)
 def setUp(self):
     self.user = UserFactory()
     self.application = ApplicationFactory()
     self.userRoles = UserRolesFactory(role_id=1, key='patroller', order=1)
     self.userRoles = UserRolesFactory(role_id=2, key='dispatcher', order=2)
     self.userRoles = UserRolesFactory(role_id=3, key='manager', order=3)
     self.incidentTemplate = IncidentTemplateFactory(template_id=1)
     self.domain4 = DomainFactory(domain='localhost', is_active=True)
     self.resort = ResortFactory(domain_id=self.domain4,
                                 resort_name='Vanilla Ski',
                                 license_expiry_date='2018-04-01T00:00:00',
                                 licenses=5)
     self.user_resort_map = UserResortMapFactory(
         role_id=self.userRoles.role_id, user=self.user, resort=self.resort)
     self.c = APIClient()
 def setUp(self):
     self.user = UserFactory()
     self.application = ApplicationFactory()
     self.routing_user = RoutingUserFactory(email='*****@*****.**')
     self.domain = DomainFactory(domain_id=1)
     self.incidentTemplate = IncidentTemplateFactory(template_id=1)
     self.resort = ResortFactory(resort_name='Vanilla Ski',
                                 license_expiry_date='2018-04-01T00:00:00',
                                 licenses=5)
     self.userRoles = UserRolesFactory()
     self.userRoles = UserRolesFactory(role_id=2, key='dispatcher', order=2)
     self.userRoles = UserRolesFactory(role_id=3, key='manager', order=3)
     self.user_resort_map = UserResortMapFactory(role_id=3,
                                                 user=self.user,
                                                 resort=self.resort)
     self.c = APIClient()
     self.token = TokenFactory(user=self.user)
 def setUp(self):
     self.user = UserFactory()
     self.application = ApplicationFactory()
     self.domain = DomainFactory(domain_id=1)
     self.domain = DomainFactory(domain_id=2,
                                 domain='api-dev-au.medic52.com',
                                 is_active=True)
     self.domain = DomainFactory(domain_id=3,
                                 domain='testserver',
                                 is_active=True)
     self.incidentTemplate = IncidentTemplateFactory(template_id=1)
     self.resort = ResortFactory(resort_name='Vanilla Ski',
                                 license_expiry_date='2018-04-01T00:00:00',
                                 licenses=5)
     self.userRoles = UserRolesFactory()
     self.userRoles = UserRolesFactory(role_id=2, key='dispatcher', order=2)
     self.userRoles = UserRolesFactory(role_id=3, key='manager', order=3)
     self.user_resort_map = UserResortMapFactory(role_id=3,
                                                 user=self.user,
                                                 resort=self.resort)
     self.c = Client()
 def setUp(self):
     self.user = UserFactory()
     self.application = ApplicationFactory()
     self.c = APIClient()
     self.token = TokenFactory(user=self.user)
class TokenFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = Token
        django_get_or_create = ('user', )

    user = UserFactory()
    def setUp(self):
        self.user = UserFactory(email='*****@*****.**',
                                name='aname',
                                is_admin=True)
        self.other_user = UserFactory(email='*****@*****.**',
                                      name='bname',
                                      is_admin=False)

        # Users for list tests:

        self.userc = UserFactory(email='*****@*****.**', name='cname')
        self.userd = UserFactory(email='*****@*****.**', name='dname')
        self.usere = UserFactory(email='*****@*****.**', name='ename')
        self.userf = UserFactory(email='*****@*****.**', name='fname')
        self.userg = UserFactory(email='*****@*****.**', name='gname')
        self.userh = UserFactory(email='*****@*****.**', name='hname')
        self.useri = UserFactory(email='*****@*****.**', name='iname')
        self.userj = UserFactory(email='*****@*****.**', name='jname')
        self.userk = UserFactory(email='*****@*****.**', name='kname')

        self.application = ApplicationFactory()
        # self.domain = DomainFactory(domain = 'testing.com', is_active = True)
        self.domain = DomainFactory(domain_id=1, is_active=True)
        self.incidentTemplate = IncidentTemplateFactory(template_id=1)
        self.resort = ResortFactory(domain_id=self.domain,
                                    resort_name='Vanilla Ski 1',
                                    license_expiry_date='2018-04-01T00:00:00',
                                    licenses=5)
        self.other_resort = ResortFactory(
            domain_id=self.domain,
            resort_name='Toggenburg',
            network_key="4520ce8",
            license_expiry_date='2018-04-01T00:00:00',
            licenses=5)
        self.userRoles = UserRolesFactory(role_id=1, key='patroller', order=1)
        self.userRoles = UserRolesFactory(role_id=2, key='dispatcher', order=2)
        self.userRoles = UserRolesFactory(role_id=3, key='manager', order=3)
        self.user_resort_map = UserResortMapFactory(role_id=3,
                                                    user=self.user,
                                                    resort=self.resort)
        self.other_user_resort_map = UserResortMapFactory(
            role_id=3, user=self.other_user, resort=self.other_resort)
        self.user_resort_map = UserResortMapFactory(role_id=3,
                                                    user=self.userc,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=3,
                                                    user=self.userd,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=2,
                                                    user=self.usere,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=2,
                                                    user=self.userf,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=2,
                                                    user=self.userg,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=1,
                                                    user=self.userh,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=1,
                                                    user=self.useri,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=1,
                                                    user=self.userj,
                                                    resort=self.resort)
        self.user_resort_map = UserResortMapFactory(role_id=1,
                                                    user=self.userk,
                                                    resort=self.resort)
        self.c = APIClient()
        self.token = TokenFactory(user=self.user)