Beispiel #1
0
 def setUpClass(cls):
     # Create a dummy account for testing with; won't touch the database
     # as long as we don't `._commit()`
     name = "unit_tester_%s" % uuid.uuid4().hex
     cls._password = uuid.uuid4().hex
     cls._account = Account(name=name,
                            password=bcrypt_password(cls._password))
Beispiel #2
0
    def setUp(self):
        # Reset the validator state and errors before every test.
        self.validator = VSubmitParent(None)
        c.errors = ErrorSet()

        c.user_is_loggedin = True
        c.user_is_admin = False
        c.user = Account(id=100)

        Account.enemy_ids = MagicMock(return_value=[])
Beispiel #3
0
    def setUp(self):
        super(TestVSubmitParent, self).setUp()
        # Reset the validator state and errors before every test.
        self.validator = VSubmitParent(None)
        c.errors = ErrorSet()

        c.user_is_loggedin = True
        c.user_is_admin = False
        c.user = Account(id=100)

        self.autopatch(Account, "enemy_ids", return_value=[])
        self.autopatch(Subreddit, "_byID", return_value=None)
Beispiel #4
0
    def setUp(self):
        name = "unit_tester_%s" % uuid.uuid4().hex
        self._password = uuid.uuid4().hex
        self._account = Account(name=name,
                                password=bcrypt_password(self._password))
        self._account._id = 1337

        c.cookies = Cookies()
        c.secure = True
        c.user_is_loggedin = True
        c.user = self._account
        c.oauth_user = None
        request.method = "POST"
Beispiel #5
0
    def setUpClass(cls):
        cls._backup_user = c.user
        cls._backup_loggedin = c.user_is_loggedin

        # Create a dummy account for testing with; won't touch the database
        # as long as we don't `._commit()`
        name = "unit_tester_%s" % uuid.uuid4().hex
        cls._password = uuid.uuid4().hex
        try:
            Account._by_name(name)
            raise AccountExists
        except NotFound:
            cls._account = Account(name=name,
                                   password=bcrypt_password(cls._password))
Beispiel #6
0
    def setUp(self):
        self.logged_in = Account(name="test")
        self.logged_out = FakeAccount()

        from r2.lib.memoize import g
        self.autopatch(g, "memoizecache", NonCache())
Beispiel #7
0
    def setUp(self):
        self.logged_in = Account(name="test")
        self.logged_out = FakeAccount()

        self.patch_g(memoizecache=NonCache())
Beispiel #8
0
 def setUp(self):
     self.logged_in = Account(name="test")
     self.logged_out = FakeAccount()