Ejemplo n.º 1
0
    def setUpTestData(cls):
        call_command("create_groups")
        cls.worker = create_user(groups=["worker"], username="******", password="******")
        cls.supervisor = create_user(groups="__all__", username="******", password="******")

        cls.department = create_department(users=[cls.supervisor, cls.worker], name="Office")

        cls.start = make_aware(datetime(2020, 1, 16, hour=12))
Ejemplo n.º 2
0
    def test_department_users_add(self):
        call_command("create_groups")
        supervisor = create_user("__all__", username="******", password="******")
        worker = create_user(["worker"], username="******", password="******")

        department = Department.objects.create(name="Office")
        department.users.add(supervisor, worker)
        self.assertListEqual(list(department.users.all()), [supervisor, worker])
 def setUp(self):
     call_command("create_groups")
     AdditionalRate.objects.create()
     self.supervisor = create_user(["supervisor"],
                                   username="******",
                                   password="******")
     self.worker = create_user(["worker"],
                               username="******",
                               password="******")
Ejemplo n.º 4
0
    def setUpClass(cls):
        super(ShiftApiTest, cls).setUpClass()
        call_command("create_groups")
        cls.department = Department.objects.create(name="office")
        cls.worker = create_user(["worker"], username="******", password="******")
        cls.shift_leader = create_user(["shift_leader", "supervisor"], username="******", password="******")
        cls.unauthorized = create_user([], username="******", password="******")

        cls.s1_start = make_aware(datetime(2020, 1, 16, hour=12))
        cls.s2_start = make_aware(datetime(2020, 1, 16, hour=8))

        cls.c = Client()
        l = cls.c.login(username="******", password="******")
Ejemplo n.º 5
0
    def setUpTestData(cls):
        call_command("create_groups")
        cls.worker1 = create_user(groups=["worker"], username="******", password="******")
        cls.worker2 = create_user(groups=["worker"], username="******", password="******")
        cls.supervisor = create_user(groups="__all__", username="******", password="******")

        cls.department = create_department(users=[cls.supervisor, cls.worker1, cls.worker2], name="Office")

        cls.shift = Shift.objects.create(
            department=cls.department,
            worker=cls.worker1,
            shift_leader=cls.supervisor,
            start=make_aware(datetime(2020, 1, 16, hour=12))
        )
Ejemplo n.º 6
0
 def handle(self, *args, **kwargs):
     call_command("create_groups")
     u = create_user("__all__",
                     username="******",
                     password="******",
                     email="*****@*****.**",
                     first_name='Admin',
                     last_name='Administrator',
                     is_staff=True,
                     is_superuser=True)
     if u:
         self.stdout.write(
             "Created admin user:\nUsername: '******'\nPassword: '******'")
     else:
         self.stdout.write("Failead to create admin user")
Ejemplo n.º 7
0
    def handle(self, *args, **kwargs):
        self.name_list = [
            "kim", "steinar", "thomas", "nikolai", "andreas", "christer"
        ]

        for name in range(len(self.name_list)):
            u = create_user(
                groups=["worker"],
                username=self.name_list[name],
                password="******",
                email=self.name_list[name] + "@" + self.name_list[name] +
                ".com",
                first_name=self.name_list[name],
            )
            if u:
                self.stdout.write(
                    f"Created {self.name_list[name]}, password is passord1234")
            else:
                self.stdout.write(
                    f"Failed to create {self.name_list[name]} user")
Ejemplo n.º 8
0
 def setUpTestData(cls):
     call_command("create_groups")
     cls.supervisor = create_user("__all__", username="******", password="******")
     cls.worker = create_user(["worker"], username="******", password="******")
Ejemplo n.º 9
0
 def setUp(self):
     call_command("create_groups")
     AdditionalRate.objects.create()
     self.department = Department.objects.create(name="Office")
     self.worker = create_user(["worker"], username="******", password="******")
     self.shift_leader = create_user(["shift_leader", "supervisor"], username="******", password="******")