コード例 #1
0
 def test_token_process_with_valid_action(self, mock_handler):
     self.payload['action'] = 'approve_registration_approval'
     token = TokenHandler.from_payload(self.payload)
     token.to_response()
     assert_true(
         mock_handler.called_with('registration', 'approve', self.payload,
                                  self.encoded_token))
コード例 #2
0
ファイル: test_tokens.py プロジェクト: aaxelb/osf.io
 def test_token_process_with_valid_action(self, mock_handler):
     self.payload['action'] = 'approve_registration_approval'
     token = TokenHandler.from_payload(self.payload)
     token.to_response()
     assert_true(
         mock_handler.called_with(
             'registration',
             'approve',
             self.payload,
             self.encoded_token
         )
     )
コード例 #3
0
 def test_token_process_for_invalid_action_raises_TokenHandlerNotFound(self):
     self.payload['action'] = 'not a handler'
     token = TokenHandler.from_payload(self.payload)
     with assert_raises(TokenHandlerNotFound):
         token.to_response()
コード例 #4
0
 def test_from_payload(self):
     token = TokenHandler.from_payload(self.payload)
     assert_equal(token.encoded_token, self.encoded_token)
     assert_equal(token.payload, self.payload)