Esempio n. 1
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script
        from scripts.initialize_dicts import run as run_initialize_dicts_script
        run_initialize_script()
        run_initialize_dicts_script()

        self.dealer_group = Group.objects.get(name='Dealer')
        self.technician_group = Group.objects.get(name='Technician')
        self.masteruser_group = Group.objects.get(name='Master User')
        self.user_group = Group.objects.get(name='User')

        bed = DeviceType.objects.get(name=DeviceType.BED)

        self.company1 = G(Company, name="C1")
        self.site1 = G(BluuSite, slug="site1", company=self.company1,
                       many_inhabitants=False)
        self.room1 = G(Room, name='Room 1', bluusite=self.site1)
        self.room2 = G(Room, name='Room 2', bluusite=self.site1)
        self.device1 = G(Device, bluusite=self.site1, company=self.company1,
                         device_type=bed, room=self.room1)
        self.device2 = G(Device, bluusite=self.site1, company=self.company1,
                         device_type=bed, room=self.room2)

        self.bluu = G(BluuUser, username='******',
                      groups=[Group.objects.get(name='Bluu')])

        self.dealer = G(BluuUser, username='******', email='*****@*****.**')

        self.masteruser = G(BluuUser, username='******',
                            email='*****@*****.**')
Esempio n. 2
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script
        run_initialize_script()

        self.company1 = G(Company, name="C1")
        self.company2 = G(Company, name="C2")

        self.user1 = G(BluuUser, username='******')
        self.user2 = G(BluuUser, username='******',
                       groups=[Group.objects.get(name='Bluu')])
        self.user3 = G(BluuUser, username='******')

        assign_perm('companies.browse_companies', self.user3)
        assign_perm('companies.view_company', self.user3, self.company1)
Esempio n. 3
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script
        run_initialize_script()

        self.company1 = G(Company, name="C1")
        self.company2 = G(Company, name="C2")

        self.bluu = G(BluuUser, username='******',
                       groups=[Group.objects.get(name='Bluu')])

        self.user = G(BluuUser, username='******', email='*****@*****.**',
                       groups=[Group.objects.get(name='Dealer')])

        self.dealer_group = Group.objects.get(name='Dealer')
        self.technician_group = Group.objects.get(name='Technician')
Esempio n. 4
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script

        run_initialize_script()

        self.company1 = G(Company, name="C1")
        self.bluusite1 = G(BluuSite, ip="", company=self.company1)
        self.device1 = G(Device, serial="serial", bluusite=self.bluusite1)

        self.user2 = G(BluuUser, username="******", groups=[Group.objects.get(name="Bluu")])

        self.ws_user = G(BluuUser, username="******")
        self.ws_user.assign_group(group=Group.objects.get(name="WebService"), obj=self.bluusite1)

        self.user3 = G(BluuUser, username="******")
Esempio n. 5
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script
        run_initialize_script()

        self.company1 = G(Company, name="C1")
        self.company2 = G(Company, name="C2")

        self.user1 = G(get_user_model(), username='******')
        self.user2 = G(get_user_model(),
                       username='******',
                       groups=[Group.objects.get(name='Bluu')])
        self.user3 = G(get_user_model(), username='******')
        
        UserObjectGroup.objects.assign(Group.objects.get(name='Bluu'), self.user3, self.company1)

        company_type = ContentType.objects.get(app_label="companies",
                                               model="company")
        perm = Permission.objects.get(content_type=company_type, codename='browse_companies')
        perm2 = Permission.objects.get(content_type=company_type, codename='view_company')
        self.user3.user_permissions.add(perm, perm2)
Esempio n. 6
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script
        run_initialize_script()

        self.dealer_group = Group.objects.get(name='Dealer')
        self.technician_group = Group.objects.get(name='Technician')
        self.masteruser_group = Group.objects.get(name='Master User')
        self.user_group = Group.objects.get(name='User')

        self.company1 = G(Company, name="C1")
        self.site1 = G(BluuSite, slug="site1", company=self.company1)

        #self.site2 = G(BluuSite, slug="site2", company=self.company1)

        self.bluu = G(BluuUser, username='******',
                      groups=[Group.objects.get(name='Bluu')])

        self.dealer = G(BluuUser, username='******', email='*****@*****.**')
                      #groups=[Group.objects.get(name='Company Employee')])

        self.masteruser = G(BluuUser, username='******',
                            email='*****@*****.**')
Esempio n. 7
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script
        run_initialize_script()

        self.company1 = G(Company, name="C1")
        self.company2 = G(Company, name="C2")

        self.bluu = G(BluuUser, username='******',
                      groups=[Group.objects.get(name='Bluu')])

        self.dealer_group = Group.objects.get(name='Dealer')
        self.technician_group = Group.objects.get(name='Technician')

        self.company1_access = G(CompanyAccess,
                                 company=self.company1,
                                 email='*****@*****.**',
                                 group=self.dealer_group,
                                 user=None)

        self.ca_ctype = ContentType.objects.get_for_model(CompanyAccess)
        self.key = InvitationKey.objects.create_invitation(
                        user=self.bluu,
                        content_object=self.company1_access)
Esempio n. 8
0
    def setUp(self):
        from scripts.initialize_roles import run as run_initialize_script
        run_initialize_script()

        self.company1 = G(Company, name="C1")
        self.company2 = G(Company, name="C2")

        self.bluu = G(BluuUser, username='******',
                      groups=[Group.objects.get(name='Bluu')])

        self.dealer = G(BluuUser, username='******', email='*****@*****.**',
                      groups=[Group.objects.get(name='Company Employee')])



        self.dealer_group = Group.objects.get(name='Dealer')
        self.technician_group = Group.objects.get(name='Technician')

        self.company1_access = G(CompanyAccess,
                                 company=self.company1,
                                 group=self.dealer_group,
                                 user=self.dealer)

        self.ca_ctype = ContentType.objects.get_for_model(CompanyAccess)