Esempio n. 1
0
def test_time_granularity(db):
    a = Drop(drop_id='abcdefghijklmnopqrstuvwxyzabcdefghijklmnfoo', message=b"Bar")
    a.save()
    b = Drop(drop_id='abcdefghijklmnopqrstuvwxyzabcdefghijklmnopo', message=b"Hello World")
    b.save()
    dt = utc_timestamp(b.created_at) - utc_timestamp(a.created_at)
    assert dt > 0
Esempio n. 2
0
 def test_head_no_messages_posted_since_etag(self):
     response = self.app.head(
         "/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopo",
         HTTP_X_QABEL_NEW_SINCE=str(utc_timestamp(self.drop.created_at) + 1),
     )
     assert response.status_code == status.HTTP_304_NOT_MODIFIED
     assert response.content == b""
Esempio n. 3
0
 def test_head_messages_posted_since_qabel(self):
     response = self.app.head(
         "/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopo",
         HTTP_X_QABEL_NEW_SINCE=str(utc_timestamp(self.dropfoo.created_at)),
     )
     assert response.status_code == status.HTTP_200_OK
     assert response.content == b""
Esempio n. 4
0
    def test_get_messages_posted_since_qabel(self):
        response = self.app.get(
            "/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopo",
            HTTP_X_QABEL_NEW_SINCE=str(utc_timestamp(self.dropfoo.created_at)),
        )

        assert response.status_code == status.HTTP_200_OK
        body = response.content.decode()
        assert "Hello World" in body
        assert "Bar" not in body