def setUp(self) -> None:
        """Setup for test case"""
        self.factory = RequestFactory()
        test_utils.setup()
        self.user = test_utils.create_dummyuser()
        self.user2 = test_utils.create_dummyuser(username="******",
                                                 email="*****@*****.**")
        self.fridge = test_utils.create_dummyfridge()
        test_utils.connect_fridge_user()
        test_utils.create_login_token(timezone.now() +
                                      timezone.timedelta(days=1),
                                      username=self.user.username)
        test_utils.create_api_token(timezone.now() +
                                    timezone.timedelta(days=1),
                                    tok="API Token",
                                    username=self.user2.username)
        test_utils.create_api_token(timezone.now() +
                                    timezone.timedelta(days=1),
                                    tok="Already in Fridge",
                                    username=self.user.username)

        self.token = "jointoken"
        test_utils.create_join_token(tok=self.token, fridge=self.fridge)
        self.s_request = self.factory.get(
            f"/fridge/management/join?token={self.token}")
        self.s_request.META["HTTP_AUTHORIZATION"] = "API Token"
Example #2
0
 def setUp(self):
     """Setup for test case"""
     self.factory = RequestFactory()
     test_utils.setup()
     test_utils.create_dummyuser()
     test_utils.create_items("Item A")
     test_utils.create_items("Item B")
     test_utils.create_api_token(timezone.now() +
                                 timezone.timedelta(hours=1))
Example #3
0
 def setUp(self):
     """Setup for test case"""
     self.factory = RequestFactory()
     test_utils.setup()
     user = test_utils.create_dummyuser(username="******")
     test_utils.create_login_token(timezone.now() +
                                   timezone.timedelta(days=1),
                                   username=user.username)
     test_utils.create_api_token(timezone.now() +
                                 timezone.timedelta(days=1),
                                 tok="API Token",
                                 username=user.username)
Example #4
0
 def setUp(self):
     """Setup for test case"""
     self.factory = RequestFactory()
     test_utils.setup()
     test_utils.create_dummyuser()
     test_utils.create_dummyfridge()
     test_utils.connect_fridge_user()
     test_utils.create_login_token(timezone.now() +
                                   timezone.timedelta(days=14))
     test_utils.create_api_token(timezone.now() +
                                 timezone.timedelta(days=14))
     test_utils.create_items("Item A")
     test_utils.create_items("Item B")
     test_utils.create_fridge_content(
         test_utils.get_item("Item A").values()[0]["item_id"],
         test_utils.get_fridge("Dummy Fridge").values()[0]["fridge_id"])
Example #5
0
 def setUp(self) -> None:
     """Setup for test case"""
     self.factory = RequestFactory()
     test_utils.setup()
     self.user = test_utils.create_dummyuser()
     self.fridge = test_utils.create_dummyfridge()
     test_utils.connect_fridge_user()
     test_utils.create_login_token(
         timezone.now() + timezone.timedelta(days=1),
         username=self.user.username
     )
     test_utils.create_api_token(
         timezone.now() + timezone.timedelta(days=1),
         tok="API Token",
         username=self.user.username
     )
     self.s_request = self.factory.get(f"/fridge/management/{self.fridge.fridge_id}/qr-code")
     self.s_request.META["HTTP_AUTHORIZATION"] = "API Token"
 def setUp(self):
     """Setup for test case"""
     self.factory = RequestFactory()
     test_utils.setup()
     test_utils.create_dummyuser()
     test_utils.create_dummyuser("us2", "user", "name", "[email protected]")
     test_utils.create_dummyfridge()
     test_utils.connect_fridge_user()
     test_utils.create_items("Item A")
     test_utils.create_items("Item B")
     test_utils.create_login_token(
         timezone.now() + timezone.timedelta(hours=1)
     )
     test_utils.create_api_token(
         timezone.now() + timezone.timedelta(hours=1)
     )
     test_utils.create_api_token(
         timezone.now() + timezone.timedelta(hours=1),
         username="******",
         tok="APIToken2"
     )
Example #7
0
    def setUp(self):
        """Setup for test case"""
        self.factory = RequestFactory()
        test_utils.setup()
        self.user = []
        self.user.append(test_utils.create_dummyuser(
            username="******",
            name="Test",
            surname="User",
            email="*****@*****.**"
        ))
        self.user.append(test_utils.create_dummyuser(
            username="******",
            name="Test 2",
            surname="User 2",
            email="*****@*****.**"
        ))
        self.user.append(test_utils.create_dummyuser(
            username="******",
            name="Test 3",
            surname="User 3",
            email="*****@*****.**"
        ))
        self.fridge = test_utils.create_dummyfridge(name="Test Fridge")

        test_utils.connect_fridge_user(
            username=self.user[0].username,
            fridge=self.fridge.name,
            role=const.Constants.ROLE_OWNER
        )
        test_utils.connect_fridge_user(
            username=self.user[1].username,
            fridge=self.fridge.name,
            role=const.Constants.ROLE_OVERSEER
        )
        test_utils.connect_fridge_user(
            username=self.user[2].username,
            fridge=self.fridge.name,
            role=const.Constants.ROLE_USER
        )

        test_utils.create_login_token(
            timezone.now() + timezone.timedelta(days=1),
            username=self.user[0].username
        )
        test_utils.create_api_token(
            timezone.now() + timezone.timedelta(days=1),
            tok="API Token User1",
            username=self.user[0].username
        )

        test_utils.create_login_token(
            timezone.now() + timezone.timedelta(days=1),
            username=self.user[1].username
        )
        test_utils.create_api_token(
            timezone.now() + timezone.timedelta(days=1),
            tok="API Token User2",
            username=self.user[1].username
        )

        test_utils.create_login_token(
            timezone.now() + timezone.timedelta(days=1),
            username=self.user[2].username
        )
        test_utils.create_api_token(
            timezone.now() + timezone.timedelta(days=1),
            tok="API Token User3",
            username=self.user[2].username
        )
        return super().setUp()