1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# __init__.py

def session_serializer(serializer_name):
    if serializer_name == "json":
        from pyramid.session import JSONSerializer 
        return JSONSerializer()
    from pyramid.session import PickleSerializer 
    return PickleSerializer()


def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application."""

    app_settings = get_children_settings(settings, "app")
    session_settings = get_children_settings(settings, "session")

    session_settings["serializer"] = session_serializer(
        session_settings.get("serializer", "pickle")
    )


"""
_______________________________________________ AuthenticatedFunctionalTests.test_notifications ________________________________________________

self = <remarkbox.test_views.AuthenticatedFunctionalTests testMethod=test_notifications>
mock_smtp = <MagicMock name='SMTP' id='139743114075216'>

    @patch("smtplib.SMTP")
    def test_notifications(self, mock_smtp):
        """
        In this test we create 2 test users.
    
        The first test user logs in, configures notification settings, and creates a new thread. This test user logs out.
    
        The next test user logs in, configures notification settings, and replies to the original thread.
    
        We test that only 1 notification is created for the first user.
    
    
        """
    
>       self._log_in_test_user(self.test_creds1)

remarkbox/test_views.py:369: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
remarkbox/test_views.py:211: in _log_in_test_user
    "/join-or-log-in?email={}&raw-otp={}".format(*test_creds)
.env/lib/python3.7/site-packages/webtest/app.py:328: in get
    expect_errors=expect_errors)
.env/lib/python3.7/site-packages/webtest/app.py:623: in do_request
    res = req.get_response(app, catch_exc_info=True)
.env/lib/python3.7/site-packages/webob/request.py:1310: in send
    application, catch_exc_info=True)
.env/lib/python3.7/site-packages/webob/request.py:1278: in call_application
    app_iter = application(self.environ, start_response)
.env/lib/python3.7/site-packages/webtest/lint.py:201: in lint_app
    iterator = application(environ, start_response_wrapper)
.env/lib/python3.7/site-packages/pyramid/router.py:270: in __call__
    response = self.execution_policy(environ, self)
.env/lib/python3.7/site-packages/pyramid_retry/__init__.py:121: in retry_policy
    response = router.invoke_request(request)
.env/lib/python3.7/site-packages/pyramid/router.py:252: in invoke_request
    request._process_response_callbacks(response)
.env/lib/python3.7/site-packages/pyramid/request.py:83: in _process_response_callbacks
    callback(self, response)
.env/lib/python3.7/site-packages/pyramid/session.py:337: in set_cookie_callback
    self._set_cookie(response)
.env/lib/python3.7/site-packages/pyramid/session.py:410: in _set_cookie
    serializer.dumps((self.accessed, self.created, dict(self)))
.env/lib/python3.7/site-packages/webob/cookies.py:660: in dumps
    sig = hmac.new(self.salted_secret, cstruct, self.digestmod).digest()
/usr/lib64/python3.7/hmac.py:153: in new
    return HMAC(key, msg, digestmod)
/usr/lib64/python3.7/hmac.py:93: in __init__
    self.update(msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <hmac.HMAC object at 0x7f187a476850>
msg = '[1583504408, 1583504408.4439087, {"_f_info": ["We already sent a link to test1@remarkbox.com. Click it to log in."]}]'

    def update(self, msg):
        """Update this hashing object with the string msg.
        """
>       self.inner.update(msg)
E       TypeError: Unicode-objects must be encoded before hashing

/usr/lib64/python3.7/hmac.py:102: TypeError
"""


"""

_______________________________________________ AuthenticatedFunctionalTests.test_notifications ________________________________________________

self = <remarkbox.test_views.AuthenticatedFunctionalTests testMethod=test_notifications>
mock_smtp = <MagicMock name='SMTP' id='140147207251088'>

    @patch("smtplib.SMTP")
    def test_notifications(self, mock_smtp):
        """
        In this test we create 2 test users.
    
        The first test user logs in, configures notification settings, and creates a new thread. This test user logs out.
    
        The next test user logs in, configures notification settings, and replies to the original thread.
    
        We test that only 1 notification is created for the first user.
    
    
        """
    
>       self._log_in_test_user(self.test_creds1)

remarkbox/test_views.py:369: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
remarkbox/test_views.py:211: in _log_in_test_user
    "/join-or-log-in?email={}&raw-otp={}".format(*test_creds)
.env/lib/python3.7/site-packages/webtest/app.py:328: in get
    expect_errors=expect_errors)
.env/lib/python3.7/site-packages/webtest/app.py:623: in do_request
    res = req.get_response(app, catch_exc_info=True)
.env/lib/python3.7/site-packages/webob/request.py:1310: in send
    application, catch_exc_info=True)
.env/lib/python3.7/site-packages/webob/request.py:1278: in call_application
    app_iter = application(self.environ, start_response)
.env/lib/python3.7/site-packages/webtest/lint.py:201: in lint_app
    iterator = application(environ, start_response_wrapper)
.env/lib/python3.7/site-packages/pyramid/router.py:270: in __call__
    response = self.execution_policy(environ, self)
.env/lib/python3.7/site-packages/pyramid_retry/__init__.py:121: in retry_policy
    response = router.invoke_request(request)
.env/lib/python3.7/site-packages/pyramid/router.py:252: in invoke_request
    request._process_response_callbacks(response)
.env/lib/python3.7/site-packages/pyramid/request.py:83: in _process_response_callbacks
    callback(self, response)
.env/lib/python3.7/site-packages/pyramid/session.py:337: in set_cookie_callback
    self._set_cookie(response)
.env/lib/python3.7/site-packages/pyramid/session.py:410: in _set_cookie
    serializer.dumps((self.accessed, self.created, dict(self)))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <webob.cookies.SignedSerializer object at 0x7f7690a1c490>
appstruct = (1583506878, 1583506877.8103864, {'_f_': [('We already sent a link to test1@remarkbox.com. Click it to log in.', 'info')]})

    def dumps(self, appstruct):
        """
        Given an ``appstruct``, serialize and sign the data.
    
        Returns a bytestring.
        """
>       cstruct = self.serializer.dumps(appstruct) # will be bytes
E       TypeError: dumps() missing 1 required positional argument: 'appstruct'

.env/lib/python3.7/site-packages/webob/cookies.py:659: TypeError
"""